mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2026-03-10 18:55:03 +00:00
Fixed failing tests
This commit is contained in:
@@ -18,7 +18,7 @@ public class ChainGetter implements CallHandler {
|
||||
|
||||
@Override
|
||||
public Object conductAction(Map<String, Object> bodyMap, HashMap<String, String> queryMap, String cognitoID) throws SQLException {
|
||||
Integer id = Integer.parseInt(queryMap.get("id"));
|
||||
Integer id = (Integer) bodyMap.get("id");
|
||||
if (id == -1) {
|
||||
PreparedStatement getChains = connection.prepareStatement(GET_CHAINS);
|
||||
System.out.println(getChains);
|
||||
|
||||
@@ -9,12 +9,12 @@ public class TestChainGetter {
|
||||
|
||||
@Test
|
||||
public void testChainGetterValid() {
|
||||
testChainGetter(false);
|
||||
testChainGetter(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChainGetterError() {
|
||||
testChainGetter(true);
|
||||
testChainGetter(false);
|
||||
}
|
||||
|
||||
public void testChainGetter(boolean shouldThrow) {
|
||||
@@ -29,7 +29,7 @@ public class TestChainGetter {
|
||||
ChainGetter chainGetter = Mockito.spy(new ChainGetter(injector, "cognitoID"));
|
||||
Map<String, Object> ignore = new HashMap<>();
|
||||
Map<String, Object> body = TestInputUtils.addBody(ignore);
|
||||
ignore.put("id", 1); //in ChainGetter.java uses ignore map for id parameter
|
||||
body.put("id", 1);
|
||||
|
||||
try {
|
||||
Object rawIDReturn = chainGetter.conductAction(body, TestInputUtils.addQueryParams(ignore), "cognitoID");
|
||||
@@ -38,6 +38,12 @@ public class TestChainGetter {
|
||||
} catch (SQLException throwables) {
|
||||
assert shouldThrow;
|
||||
throwables.printStackTrace();
|
||||
} catch (NumberFormatException throwables) {
|
||||
assert shouldThrow;
|
||||
throwables.printStackTrace();
|
||||
} catch (ClassCastException throwables) {
|
||||
assert shouldThrow;
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user