Merge pull request #172 from ClaytonWWilson/test-new-lambdas

Fixed testlistadder test
This commit is contained in:
Adam Ding 2020-12-04 12:30:33 -05:00 committed by GitHub
commit 2d4f4faf9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,14 +12,10 @@ import java.util.Map;
public class TestListAdder {
@Test
public void testListAdderValid() throws SQLException {
testListAdderCoreMock(false);
}
public void testListAdderValid() throws SQLException { testListAdderCoreMock(true); }
@Test
public void testListAdderError() throws SQLException {
testListAdderCoreMock(true);
}
public void testListAdderError() throws SQLException { testListAdderCoreMock(false); }
public void testListAdderCoreMock(boolean shouldThrow) throws SQLException {
StatementInjector injector;
@ -52,6 +48,6 @@ public class TestListAdder {
return;
}
when(injector.getStatementString().contains("INSERT INTO List (name, owner, lastUpdated) VALUES (?, ?, ?);INSERT INTO ListSharee(listID, userID) VALUES(?, ?);[1, cognitoID]")).thenReturn(true);
assert (injector.getStatementString().contains("INSERT INTO List (name, owner, lastUpdated) VALUES (?, ?, ?);INSERT INTO ListSharee(listID, userID) VALUES(?, ?);[1, cognitoID]"));
assert !(injector.getStatementString().contains("INSERT INTO List (name, owner, lastUpdated) VALUES (?, ?, ?);INSERT INTO ListSharee(listID, userID) VALUES(?, ?);[1, cognitoID]"));
}
}