From 8f3840e0d78d0395b4a5a9cad0ae6517b25f848e Mon Sep 17 00:00:00 2001 From: Adam Ding Date: Mon, 30 Nov 2020 18:45:10 -0500 Subject: [PATCH] Mocked testlistentrydeleter --- Lambdas/Lists/ListEntry/test/TestListEntryAdder.java | 2 +- .../Lists/ListEntry/test/TestListEntryDeleter.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Lambdas/Lists/ListEntry/test/TestListEntryAdder.java b/Lambdas/Lists/ListEntry/test/TestListEntryAdder.java index 85e69f3..a68bb15 100644 --- a/Lambdas/Lists/ListEntry/test/TestListEntryAdder.java +++ b/Lambdas/Lists/ListEntry/test/TestListEntryAdder.java @@ -17,7 +17,7 @@ public class TestListEntryAdder { public void testListEntryAdderError() { testListEntryAdderCoreMock(true); } - + public void testListEntryAdderCoreMock(boolean shouldThrow) { StatementInjector injector; try { diff --git a/Lambdas/Lists/ListEntry/test/TestListEntryDeleter.java b/Lambdas/Lists/ListEntry/test/TestListEntryDeleter.java index a0d0c14..293f469 100644 --- a/Lambdas/Lists/ListEntry/test/TestListEntryDeleter.java +++ b/Lambdas/Lists/ListEntry/test/TestListEntryDeleter.java @@ -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 ignore = new HashMap<>(); Map body = TestInputUtils.addBody(ignore); body.put("productID", 16);