Lambda Delete Tests

Also include a contract fix for ListEntryDeleter
This commit is contained in:
NMerz
2020-10-08 19:01:09 -04:00
parent 508818c700
commit b07fead480
5 changed files with 112 additions and 25 deletions

View File

@@ -22,7 +22,7 @@ public class TestListAdder {
ArrayList<Object> rsReturns = new ArrayList<>();
rsReturns.add(1); //new listID
try {
injector = new StatementInjector(null, null, shouldThrow);
injector = new StatementInjector(null, rsReturns, shouldThrow);
} catch (SQLException throwables) {
throwables.printStackTrace();
assert false; //Error in test infrastructure
@@ -35,7 +35,11 @@ public class TestListAdder {
try {
Object rawIDReturn = listAdder.conductAction(body, TestInputUtils.addQueryParams(ignore), "cognitoID");
assert !shouldThrow;
assert (rawIDReturn.getClass() == Integer.class);
if (!(rawIDReturn.getClass() == Integer.class)) {
assert false;
return;
}
assert (((Integer) rawIDReturn) == 1);
assert (injector.getStatementString().contains("INSERT INTO List (name, owner, lastUpdated) VALUES (?, ?, ?)[aname, cognitoID,"));
} catch (SQLException throwables) {
assert shouldThrow;