mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-17 02:58:48 +00:00
Mocked testlistentryadder
This commit is contained in:
parent
cff2bee7a5
commit
00d740631c
@ -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;
|
||||||
@ -8,15 +10,15 @@ public class TestListEntryAdder {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListEntryAdderValid() {
|
public void testListEntryAdderValid() {
|
||||||
testListEntryAdderCore(false);
|
testListEntryAdderCoreMock(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListEntryAdderError() {
|
public void testListEntryAdderError() {
|
||||||
testListEntryAdderCore(true);
|
testListEntryAdderCoreMock(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListEntryAdderCore(boolean shouldThrow) {
|
public void testListEntryAdderCoreMock(boolean shouldThrow) {
|
||||||
StatementInjector injector;
|
StatementInjector injector;
|
||||||
try {
|
try {
|
||||||
injector = new StatementInjector(null, null, shouldThrow);
|
injector = new StatementInjector(null, null, shouldThrow);
|
||||||
@ -25,7 +27,7 @@ public class TestListEntryAdder {
|
|||||||
assert false; //Error in test infrastructure
|
assert false; //Error in test infrastructure
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ListEntryAdder listEntryAdder = new ListEntryAdder(injector, "cognitoID");
|
ListEntryAdder listEntryAdder = Mockito.spy(new ListEntryAdder(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