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

@ -17,7 +17,7 @@ public class TestListEntryAdder {
public void testListEntryAdderError() {
testListEntryAdderCoreMock(true);
}
public void testListEntryAdderCoreMock(boolean shouldThrow) {
StatementInjector injector;
try {

View File

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