Mocked testlistentrydeleter

This commit is contained in:
Adam Ding 2020-11-30 18:45:10 -05:00
parent 00d740631c
commit 8f3840e0d7
2 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,6 @@
import org.junit.Test; import org.junit.Test;
import org.mockito.Mockito;
import org.mockito.Mockito.*;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.HashMap; import java.util.HashMap;
@ -7,16 +9,14 @@ import java.util.Map;
public class TestListEntryDeleter { public class TestListEntryDeleter {
@Test @Test
public void testListEntryDeleterValid() { public void testListEntryDeleterValid() { testListEntryDeleterCoreMock(false); }
testListEntryDeleterCore(false);
}
@Test @Test
public void testListEntryDeleterError() { public void testListEntryDeleterError() {
testListEntryDeleterCore(true); testListEntryDeleterCoreMock(true);
} }
public void testListEntryDeleterCore(boolean shouldThrow) { public void testListEntryDeleterCoreMock(boolean shouldThrow) {
StatementInjector injector; StatementInjector injector;
try { try {
injector = new StatementInjector(null, null, shouldThrow); injector = new StatementInjector(null, null, shouldThrow);
@ -25,7 +25,7 @@ public class TestListEntryDeleter {
assert false; //Error in test infrastructure assert false; //Error in test infrastructure
return; return;
} }
ListEntryDeleter listEntryDeleter = new ListEntryDeleter(injector, "cognitoID"); ListEntryDeleter listEntryDeleter = Mockito.spy(new ListEntryDeleter(injector, "cognitoID"));
Map<String, Object> ignore = new HashMap<>(); Map<String, Object> ignore = new HashMap<>();
Map<String, Object> body = TestInputUtils.addBody(ignore); Map<String, Object> body = TestInputUtils.addBody(ignore);
body.put("productID", 16); body.put("productID", 16);