mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2026-03-11 02:55:04 +00:00
Removed old tests
This commit is contained in:
@@ -16,7 +16,7 @@ public class TestListDelete {
|
||||
|
||||
@Test
|
||||
public void testListDeleterWOAccess() {
|
||||
testListDeleterCore(false, false);
|
||||
testListDeleterCoreMock(false, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -24,38 +24,6 @@ public class TestListDelete {
|
||||
testListDeleterCoreMock(true, true);
|
||||
}
|
||||
|
||||
public void testListDeleterCore(boolean shouldThrow, boolean hasAccess) {
|
||||
StatementInjector injector;
|
||||
ArrayList<Object> rsReturns = new ArrayList<>();
|
||||
rsReturns.add("cognitoID");
|
||||
try {
|
||||
if (!hasAccess) {
|
||||
rsReturns = null;
|
||||
}
|
||||
injector = new StatementInjector(null, rsReturns, shouldThrow);
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
assert false; //Error in test infrastructure
|
||||
return;
|
||||
}
|
||||
ListDeleter listDeleter = new ListDeleter(injector, "cognitoID");
|
||||
Map<String, Object> body = (Map<String, Object>) TestBasicHandler.buildFullSampleMap().get("body");
|
||||
HashMap<String, String> queryParams = (HashMap<String, String>) TestBasicHandler.buildFullSampleMap().get("body");
|
||||
queryParams.put("id", "30");
|
||||
|
||||
try {
|
||||
Object rawIDReturn = listDeleter.conductAction(body, queryParams, "cognitoID");
|
||||
assert !shouldThrow;
|
||||
assert (rawIDReturn == null);
|
||||
System.out.println(injector.getStatementString());
|
||||
assert (injector.getStatementString().equals("SELECT * FROM List WHERE (owner = ? AND listID = ?);DELETE FROM ListSharee where listID = ?;DELETE FROM ListProduct where listID = ?;DELETE FROM List WHERE listID = ?;[30]"));
|
||||
} catch (SQLException throwables) {
|
||||
assert shouldThrow ;
|
||||
} catch (AccessControlException accessControlException) {
|
||||
assert !hasAccess;
|
||||
}
|
||||
}
|
||||
|
||||
public void testListDeleterCoreMock(boolean shouldThrow, boolean hasAccess) {
|
||||
StatementInjector injector;
|
||||
ArrayList<Object> rsReturns = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user