mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 02:38:47 +00:00
Mocked testlistentrydeleter
This commit is contained in:
parent
00d740631c
commit
8f3840e0d7
@ -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);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user