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 { public class TestListAdder {
@Test @Test
public void testListAdderValid() throws SQLException { public void testListAdderValid() throws SQLException { testListAdderCoreMock(true); }
testListAdderCoreMock(false);
}
@Test @Test
public void testListAdderError() throws SQLException { public void testListAdderError() throws SQLException { testListAdderCoreMock(false); }
testListAdderCoreMock(true);
}
public void testListAdderCoreMock(boolean shouldThrow) throws SQLException { public void testListAdderCoreMock(boolean shouldThrow) throws SQLException {
StatementInjector injector; StatementInjector injector;
@ -52,6 +48,6 @@ public class TestListAdder {
return; return;
} }
when(injector.getStatementString().contains("INSERT INTO List (name, owner, lastUpdated) VALUES (?, ?, ?);INSERT INTO ListSharee(listID, userID) VALUES(?, ?);[1, cognitoID]")).thenReturn(true); 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]"));
} }
} }