Skip to content
Snippets Groups Projects
Commit f606ec0e authored by Andre Hartig's avatar Andre Hartig
Browse files

Added filter test method for OperationService

parent f3c56f9d
No related branches found
No related tags found
No related merge requests found
......@@ -326,11 +326,16 @@ class JDBCRepository implements Repository
* Adds each found Operation to the list.
* @param filter the filter
* @return the matching entries
* TODO Ask how to remove "Optional[]" from filter.date()
*/
@Override
public List<Operation> findOperations(Operation.Filter filter) {
var sql = "SELECT * FROM operations WHERE date = " + filter.date() + ";";
var sql = "SELECT * FROM operations WHERE date = " +
sqlValue(filter.date()).
replace("Optional", "").
replace("[", "").
replace("]", "") + ";";
try (
var resultSet =
......
......@@ -106,4 +106,14 @@ public final class Tests
System.out.println(operation);
}
@Test
public void testGetOperations() {
Operation.Filter filter = new Operation.Filter(Optional.of(LocalDate.of(2024, 05, 24)));
List<Operation> operations = opService.getOperations(filter);
for (Operation operation : operations)
System.out.println(operation);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment