From a38dd5bd957e6d4b892fa09dec769a0aef9c783f Mon Sep 17 00:00:00 2001 From: chipowok Date: Thu, 9 Apr 2020 02:20:36 +0200 Subject: [PATCH 1/2] Copy/Paste Error on parameters name (CartItem instead of Contact) --- .../exercise8/networking/GetContactsHttpEndpoint.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_driven_development/src/main/java/com/techyourchance/testdrivendevelopment/exercise8/networking/GetContactsHttpEndpoint.java b/test_driven_development/src/main/java/com/techyourchance/testdrivendevelopment/exercise8/networking/GetContactsHttpEndpoint.java index ec5c2ae5..4107882c 100755 --- a/test_driven_development/src/main/java/com/techyourchance/testdrivendevelopment/exercise8/networking/GetContactsHttpEndpoint.java +++ b/test_driven_development/src/main/java/com/techyourchance/testdrivendevelopment/exercise8/networking/GetContactsHttpEndpoint.java @@ -10,7 +10,7 @@ enum FailReason { } interface Callback { - void onGetContactsSucceeded(List cartItems); + void onGetContactsSucceeded(List contactSchemas); void onGetContactsFailed(FailReason failReason); } From d1b5e916f534444d67cf7cb58c3abaafcc4ee584 Mon Sep 17 00:00:00 2001 From: chipowok Date: Thu, 9 Apr 2020 02:21:35 +0200 Subject: [PATCH 2/2] Remove unused imports and move getCartItemSchemes() into the correct region helper section --- ...chCartItemsManualTestDoublesUseCaseTest.java | 12 ++++++------ .../example11/FetchCartItemsUseCaseTest.java | 17 ++++++----------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/test_driven_development/src/test/java/com/techyourchance/testdrivendevelopment/example11/FetchCartItemsManualTestDoublesUseCaseTest.java b/test_driven_development/src/test/java/com/techyourchance/testdrivendevelopment/example11/FetchCartItemsManualTestDoublesUseCaseTest.java index c7a90f26..13fd8a27 100755 --- a/test_driven_development/src/test/java/com/techyourchance/testdrivendevelopment/example11/FetchCartItemsManualTestDoublesUseCaseTest.java +++ b/test_driven_development/src/test/java/com/techyourchance/testdrivendevelopment/example11/FetchCartItemsManualTestDoublesUseCaseTest.java @@ -49,12 +49,6 @@ public void setup() throws Exception { success(); } - private List getCartItemSchemes() { - List schemas = new ArrayList<>(); - schemas.add(new CartItemSchema(ID, TITLE, DESCRIPTION, PRICE)); - return schemas; - } - @Test public void fetchCartItems_correctLimitPassedToEndpoint() throws Exception { // Arrange @@ -129,6 +123,12 @@ private List getCartItems() { return cartItems; } + private List getCartItemSchemes() { + List schemas = new ArrayList<>(); + schemas.add(new CartItemSchema(ID, TITLE, DESCRIPTION, PRICE)); + return schemas; + } + private void success() { // no-op } diff --git a/test_driven_development/src/test/java/com/techyourchance/testdrivendevelopment/example11/FetchCartItemsUseCaseTest.java b/test_driven_development/src/test/java/com/techyourchance/testdrivendevelopment/example11/FetchCartItemsUseCaseTest.java index 021ec03b..758bf9ff 100755 --- a/test_driven_development/src/test/java/com/techyourchance/testdrivendevelopment/example11/FetchCartItemsUseCaseTest.java +++ b/test_driven_development/src/test/java/com/techyourchance/testdrivendevelopment/example11/FetchCartItemsUseCaseTest.java @@ -16,17 +16,12 @@ import org.mockito.stubbing.Answer; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; @@ -58,12 +53,6 @@ public void setup() throws Exception { success(); } - private List getCartItemSchemes() { - List schemas = new ArrayList<>(); - schemas.add(new CartItemSchema(ID, TITLE, DESCRIPTION, PRICE)); - return schemas; - } - @Test public void fetchCartItems_correctLimitPassedToEndpoint() throws Exception { // Arrange @@ -139,6 +128,12 @@ private List getCartItems() { return cartItems; } + private List getCartItemSchemes() { + List schemas = new ArrayList<>(); + schemas.add(new CartItemSchema(ID, TITLE, DESCRIPTION, PRICE)); + return schemas; + } + private void success() { doAnswer(new Answer() { @Override