### Question:
RegisterLocationAdapter { public HttpResponse registerLocation(final Location location) { HttpResponse httpResponse; if (isValidInput(location)) { final RegisterLocationInputData registerLocationInputData = buildInputData(location); inputPort.registerLocation(registerLocationInputData, outputPort); httpResponse = outputPort.getHttpResponse(); } else { httpResponse = new HttpResponse(HttpStatus.BAD_REQUEST, "Invalid input data!"); } return httpResponse; } RegisterLocationAdapter(final RegisterLocationInputPort inputPort); HttpResponse registerLocation(final Location location);  }### Answer:
@Test public void test_registerLocation_nullLocation_returnsBadRequest() { final RegisterLocationAdapter registerLocationAdapter = new RegisterLocationAdapter( new MockRegisterLocationInputPort()); final HttpResponse httpResponse = registerLocationAdapter.registerLocation(null); Assertions.assertEquals(HttpStatus.BAD_REQUEST, httpResponse.getStatus()); }
@Test public void test_registerLocation_nullLocationName_returnsBadRequest() { final RegisterLocationAdapter registerLocationAdapter = new RegisterLocationAdapter( new MockRegisterLocationInputPort()); final Location location = new Location(); final HttpResponse httpResponse = registerLocationAdapter.registerLocation(location); Assertions.assertEquals(HttpStatus.BAD_REQUEST, httpResponse.getStatus()); }
@Test public void test_registerLocation_locationName_returnsCreated() { final RegisterLocationAdapter registerLocationAdapter = new RegisterLocationAdapter( new MockRegisterLocationInputPort()); final Location location = new Location(); location.setName("name"); final HttpResponse httpResponse = registerLocationAdapter.registerLocation(location); Assertions.assertEquals(HttpStatus.CREATED, httpResponse.getStatus()); }
@Test public void test_registerLocation_sameLocationName_returnsCreated() { final RegisterLocationAdapter registerLocationAdapter = new RegisterLocationAdapter( new MockRegisterLocationInputPort()); final Location location = new Location(); location.setName("name"); HttpResponse httpResponse = registerLocationAdapter.registerLocation(location); Assertions.assertEquals(HttpStatus.CREATED, httpResponse.getStatus()); httpResponse = registerLocationAdapter.registerLocation(location); Assertions.assertEquals(HttpStatus.CONFLICT, httpResponse.getStatus()); }