From 8c7ecb353a7ca171e8b497d0aab48b70477f0073 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 6 Dec 2014 18:56:54 -0300 Subject: [PATCH] Plosh test helpers structure and names --- .../controllers/standalone/AddWorkerCtrlTest.java | 15 ++++++++------- .../standalone/helpers/TestHelper.java} | 4 ++-- .../doubles/AddWorkerInteractorFactoryStub.java | 2 +- .../doubles/AddWorkerRequestBuilderStub.java} | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) rename web-interface/src/test/java/org/reparationservice/rest/{utils/TestUtil.java => controllers/standalone/helpers/TestHelper.java} (84%) rename web-interface/src/test/java/org/reparationservice/rest/{utils => controllers/standalone/helpers}/doubles/AddWorkerInteractorFactoryStub.java (93%) rename web-interface/src/test/java/org/reparationservice/rest/{utils/doubles/RequestBuilderStub.java => controllers/standalone/helpers/doubles/AddWorkerRequestBuilderStub.java} (77%) diff --git a/web-interface/src/test/java/org/reparationservice/rest/controllers/standalone/AddWorkerCtrlTest.java b/web-interface/src/test/java/org/reparationservice/rest/controllers/standalone/AddWorkerCtrlTest.java index 2f612fc..70285fc 100644 --- a/web-interface/src/test/java/org/reparationservice/rest/controllers/standalone/AddWorkerCtrlTest.java +++ b/web-interface/src/test/java/org/reparationservice/rest/controllers/standalone/AddWorkerCtrlTest.java @@ -6,13 +6,14 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import java.io.IOException; + import org.junit.Before; import org.junit.Test; import org.reparationservice.rest.controllers.AddWorkerController; +import org.reparationservice.rest.controllers.standalone.helpers.TestHelper; +import org.reparationservice.rest.controllers.standalone.helpers.doubles.AddWorkerInteractorFactoryStub; +import org.reparationservice.rest.controllers.standalone.helpers.doubles.AddWorkerRequestBuilderStub; import org.reparationservice.rest.requests.AddWorkerJsonRequest; -import org.reparationservice.rest.utils.TestUtil; -import org.reparationservice.rest.utils.doubles.AddWorkerInteractorFactoryStub; -import org.reparationservice.rest.utils.doubles.RequestBuilderStub; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -23,17 +24,17 @@ public class AddWorkerCtrlTest { private static final String WORKER_USERNAME_1 = "username1"; private static final String WORKER_USERNAME_2 = "username2"; - private static final MediaType JSON_HAL_CONTENT_TYPE = TestUtil.JSON_HAL_CONTENT_TYPE; + private static final MediaType JSON_HAL_CONTENT_TYPE = TestHelper.JSON_HAL_CONTENT_TYPE; private AddWorkerController addWorkerCtrl; private MockMvc mockMvc; private AddWorkerInteractorFactoryStub intFactoryStub; - private RequestBuilderStub requestBuilderStub; + private AddWorkerRequestBuilderStub requestBuilderStub; private WorkerGateway workerGW; @Before public void setup() throws Exception { intFactoryStub = AddWorkerInteractorFactoryStub.newInstance(); - requestBuilderStub = new RequestBuilderStub(); + requestBuilderStub = new AddWorkerRequestBuilderStub(); workerGW = new WorkerGatewaySpy(); addWorkerCtrl = new AddWorkerController(intFactoryStub, workerGW, requestBuilderStub); mockMvc = MockMvcBuilders.standaloneSetup(addWorkerCtrl).build(); @@ -73,6 +74,6 @@ private void sendWorkerPostRequestFor(String username) throws Exception, IOExcep } private byte[] getJsonWorkerReq(String username) throws IOException { - return TestUtil.object2JsonBytes(AddWorkerJsonRequest.newInstance(username)); + return TestHelper.object2JsonBytes(AddWorkerJsonRequest.newInstance(username)); } } diff --git a/web-interface/src/test/java/org/reparationservice/rest/utils/TestUtil.java b/web-interface/src/test/java/org/reparationservice/rest/controllers/standalone/helpers/TestHelper.java similarity index 84% rename from web-interface/src/test/java/org/reparationservice/rest/utils/TestUtil.java rename to web-interface/src/test/java/org/reparationservice/rest/controllers/standalone/helpers/TestHelper.java index 9bbbb5d..9766ff8 100644 --- a/web-interface/src/test/java/org/reparationservice/rest/utils/TestUtil.java +++ b/web-interface/src/test/java/org/reparationservice/rest/controllers/standalone/helpers/TestHelper.java @@ -1,4 +1,4 @@ -package org.reparationservice.rest.utils; +package org.reparationservice.rest.controllers.standalone.helpers; import java.io.IOException; @@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; -public class TestUtil { +public class TestHelper { public static final MediaType JSON_HAL_CONTENT_TYPE = new MediaType("application", "hal+json"); public static byte[] object2JsonBytes(Object object) throws IOException { diff --git a/web-interface/src/test/java/org/reparationservice/rest/utils/doubles/AddWorkerInteractorFactoryStub.java b/web-interface/src/test/java/org/reparationservice/rest/controllers/standalone/helpers/doubles/AddWorkerInteractorFactoryStub.java similarity index 93% rename from web-interface/src/test/java/org/reparationservice/rest/utils/doubles/AddWorkerInteractorFactoryStub.java rename to web-interface/src/test/java/org/reparationservice/rest/controllers/standalone/helpers/doubles/AddWorkerInteractorFactoryStub.java index 59aa05d..4a3319d 100644 --- a/web-interface/src/test/java/org/reparationservice/rest/utils/doubles/AddWorkerInteractorFactoryStub.java +++ b/web-interface/src/test/java/org/reparationservice/rest/controllers/standalone/helpers/doubles/AddWorkerInteractorFactoryStub.java @@ -1,4 +1,4 @@ -package org.reparationservice.rest.utils.doubles; +package org.reparationservice.rest.controllers.standalone.helpers.doubles; import reparationservice.entities.worker.WorkerGateway; import reparationservice.requestor.UseCaseActivator; diff --git a/web-interface/src/test/java/org/reparationservice/rest/utils/doubles/RequestBuilderStub.java b/web-interface/src/test/java/org/reparationservice/rest/controllers/standalone/helpers/doubles/AddWorkerRequestBuilderStub.java similarity index 77% rename from web-interface/src/test/java/org/reparationservice/rest/utils/doubles/RequestBuilderStub.java rename to web-interface/src/test/java/org/reparationservice/rest/controllers/standalone/helpers/doubles/AddWorkerRequestBuilderStub.java index 7459046..781a5c7 100644 --- a/web-interface/src/test/java/org/reparationservice/rest/utils/doubles/RequestBuilderStub.java +++ b/web-interface/src/test/java/org/reparationservice/rest/controllers/standalone/helpers/doubles/AddWorkerRequestBuilderStub.java @@ -1,9 +1,9 @@ -package org.reparationservice.rest.utils.doubles; +package org.reparationservice.rest.controllers.standalone.helpers.doubles; import reparationservice.requestor.UseCaseRequest; import reparationservice.usecases.worker.AddWorkerRequestBuilder; -public class RequestBuilderStub implements AddWorkerRequestBuilder { +public class AddWorkerRequestBuilderStub implements AddWorkerRequestBuilder { private boolean buildCalled = false; private String username;