Skip to content

Commit

Permalink
Plosh test helpers structure and names
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Dec 6, 2014
1 parent da9a17b commit 8c7ecb3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -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));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.reparationservice.rest.utils;
package org.reparationservice.rest.controllers.standalone.helpers;

import java.io.IOException;

Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down

0 comments on commit 8c7ecb3

Please sign in to comment.