Skip to content

Commit

Permalink
Polish up code and typos using code inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
palpa committed Dec 14, 2014
1 parent b822014 commit 36e7a4a
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class CustomerImpl extends Customer {
private final long customerId;
private Map<Long, Device> devices = new HashMap<Long, Device>();
private Map<Long, Device> devices = new HashMap<>();

public CustomerImpl(long customerId) {
this.customerId = customerId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public final class DeviceImpl extends Device {
private final long serialNumber;
private final Map<DateTime, Reparation> reparations = new HashMap<DateTime, Reparation>();
private final Map<DateTime, Reparation> reparations = new HashMap<>();

public DeviceImpl(long serialNumber) {
this.serialNumber = serialNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

public class ReparationService implements WorkerGateway, DeviceTypeGateway,
CustomerGateway {
private Map<String, Worker> workers = new HashMap<String, Worker>();
private Map<String, DeviceType> deviceTypes = new HashMap<String, DeviceType>();
private Map<Long, Customer> customers = new HashMap<Long, Customer>();
private Map<String, Worker> workers = new HashMap<>();
private Map<String, DeviceType> deviceTypes = new HashMap<>();
private Map<Long, Customer> customers = new HashMap<>();

@Override
public void addWorker(WorkerDTO workerDTO) {
Expand All @@ -27,7 +27,7 @@ public void addWorker(WorkerDTO workerDTO) {

@Override
public List<Worker> getAllWorkers() {
return new ArrayList<Worker>(workers.values());
return new ArrayList<>(workers.values());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package reparationservice.entities.customer;


public class CusromerWithDeviceSpy extends NotEmptyCustomerSpy {
public class CustomerWithDeviceSpy extends NotEmptyCustomerSpy {
public static final long DEVICE_SERIAL_NUMBER = 10;

public CusromerWithDeviceSpy() {
public CustomerWithDeviceSpy() {
super();
customer.addDevice(DEVICE_SERIAL_NUMBER);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ public Worker getWorkerByUserName(String workerUserName) {
}

public boolean getAllWorkersWasCalled() {
this.getAllWorkerCalled = true;
return getAllWorkerCalled;
}

@Override
public List<Worker> getAllWorkers() {
return new ArrayList<Worker>();
this.getAllWorkerCalled = true;
return new ArrayList<>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import org.junit.Before;
import org.junit.Test;

import reparationservice.entities.worker.Worker;
import reparationservice.entities.worker.WorkerDTO;
import reparationservice.entities.worker.WorkerGateway;
import reparationservice.persistenceimpls.inmemory.InMemoryConfigurator;

public class WorkerGatewayTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.junit.runner.RunWith;

import de.bechte.junit.runners.context.HierarchicalContextRunner;
import reparationservice.entities.customer.CusromerWithDeviceSpy;
import reparationservice.entities.customer.CustomerWithDeviceSpy;
import reparationservice.entities.customer.CustomerGateway;
import reparationservice.entities.customer.CustomerGatewaySpy;
import reparationservice.entities.customer.NotEmptyCustomerSpy;
Expand All @@ -21,7 +21,7 @@ public class AddReparationInteractorTest {
private static final int CUSTOMER_ID = NotEmptyCustomerSpy.CUSTOMER_ID;
private static final String DEVICE_FAILURE = "failure";
private static final DateTime CREATION_DATE = DateTime.now();
private static final long DEVICE_SERIAL_NUMBER = CusromerWithDeviceSpy.DEVICE_SERIAL_NUMBER;
private static final long DEVICE_SERIAL_NUMBER = CustomerWithDeviceSpy.DEVICE_SERIAL_NUMBER;
private static final String REPARATION_OBSERVATIONS = "observations";
private static final String REPARATION_URGENCY = "urgency";

Expand All @@ -44,7 +44,7 @@ public void checkReparationRequest() {
}

@Test(expected = AddReparationInteractor.CustomerNotFound.class)
public void throwCustomerNotFoundWhenProvidedCustomerIdDontMatchWithAnyCustomer() {
public void throwCustomerNotFoundWhenProvidedCustomerIdDoesNotMatchWithAnyCustomer() {
CustomerGateway emptyCustomersSpy = new CustomerGatewaySpy();
addReparation = new AddReparationInteractor(emptyCustomersSpy, request);
addReparation.execute();
Expand All @@ -67,7 +67,7 @@ public class DeviceIsFound {

@Before
public void givenDevice() {
customerWithDeviceSpy = new CusromerWithDeviceSpy();
customerWithDeviceSpy = new CustomerWithDeviceSpy();
addReparation = new AddReparationInteractor(customerWithDeviceSpy, request);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
public class GetAllWorkersInteractorTest {

@Test(expected = GetAllWorkerInteractor.WorkerGatewayNotNull.class)
public void throwExeptionWhenNullGatewayPassed() {
public void throwExceptionWhenNullGatewayPassed() {
new GetAllWorkerInteractor(null, new GetAllWorkersResponderSpy());
}

@Test(expected = GetAllWorkerInteractor.PresenterNotNull.class)
public void throwExeptionWhenNullPresenterPassed() {
public void throwExceptionWhenNullPresenterPassed() {
new GetAllWorkerInteractor(new GetAllWorkersGatewaySpy(), null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ 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 = TestHelper.JSON_HAL_CONTENT_TYPE;
private AddWorkerController addWorkerCtrl;
private MockMvc mockMvc;
private AddWorkerInteractorFactoryStub intFactoryStub;
private AddWorkerRequestBuilderStub requestBuilderStub;
Expand All @@ -36,7 +35,7 @@ public void setup() throws Exception {
intFactoryStub = AddWorkerInteractorFactoryStub.newInstance();
requestBuilderStub = new AddWorkerRequestBuilderStub();
workerGW = new WorkerGatewaySpy();
addWorkerCtrl = new AddWorkerController(intFactoryStub, workerGW, requestBuilderStub);
AddWorkerController addWorkerCtrl = new AddWorkerController(intFactoryStub, workerGW, requestBuilderStub);
mockMvc = MockMvcBuilders.standaloneSetup(addWorkerCtrl).build();
sendWorkerPostRequestFor(WORKER_USERNAME_1);
}
Expand Down Expand Up @@ -64,7 +63,7 @@ private void assertRequestFor(String workerUsername) {
assertThat(requestBuilderStub.withArgs(workerUsername)).isTrue();
}

private void sendWorkerPostRequestFor(String username) throws Exception, IOException {
private void sendWorkerPostRequestFor(String username) throws Exception {
mockMvc.perform(
post("/workers")
.contentType(JSON_HAL_CONTENT_TYPE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import org.junit.Test;

public class AditionalTest extends ControllerTest {
public class AdditionalTest extends ControllerTest {
@Test
public void returnNotFoundErrorWhenPostToWrongPath() throws Exception {
mockMvc.perform(post("/wrong/path")
Expand Down

0 comments on commit 36e7a4a

Please sign in to comment.