### Question:
RegisterRenterAdapter { public HttpResponse registerRenter(final Renter renter) { HttpResponse httpResponse; if (isValidInput(renter)) { final RegisterRenterInputData registerRenterInputData = buildInputData(renter); inputPort.registerRenter(registerRenterInputData, outputPort); httpResponse = outputPort.getHttpResponse(); } else { httpResponse = new HttpResponse(HttpStatus.BAD_REQUEST, "Invalid input data!"); } return httpResponse; } RegisterRenterAdapter(final RegisterRenterInputPort inputPort); HttpResponse registerRenter(final Renter renter);  }### Answer:
@Test public void test_registerRenter_nullRenter_returnsBadRequest() { final RegisterRenterAdapter registerRenterAdapter = new RegisterRenterAdapter( new MockRegisterRenterInputPort()); final HttpResponse httpResponse = registerRenterAdapter.registerRenter(null); Assertions.assertEquals(HttpStatus.BAD_REQUEST, httpResponse.getStatus()); }
@Test public void test_registerRenter_nullRenterFirstName_returnsBadRequest() { final RegisterRenterAdapter registerRenterAdapter = new RegisterRenterAdapter( new MockRegisterRenterInputPort()); final Renter renter = new Renter(); renter.setFirstName(null); renter.setLastName("Doe"); renter.setEmail("john.doe@email.com"); final HttpResponse httpResponse = registerRenterAdapter.registerRenter(renter); Assertions.assertEquals(HttpStatus.BAD_REQUEST, httpResponse.getStatus()); }
@Test public void test_registerRenter_nullRenterLastName_returnsBadRequest() { final RegisterRenterAdapter registerRenterAdapter = new RegisterRenterAdapter( new MockRegisterRenterInputPort()); final Renter renter = new Renter(); renter.setFirstName("John"); renter.setLastName(null); renter.setEmail("john.doe@email.com"); final HttpResponse httpResponse = registerRenterAdapter.registerRenter(renter); Assertions.assertEquals(HttpStatus.BAD_REQUEST, httpResponse.getStatus()); }
@Test public void test_registerRenter_invalidEmail_returnsBadRequest() { final RegisterRenterAdapter registerRenterAdapter = new RegisterRenterAdapter( new MockRegisterRenterInputPort()); final Renter renter = new Renter(); renter.setFirstName("John"); renter.setLastName("Doe"); renter.setEmail("john.doe@email"); final HttpResponse httpResponse = registerRenterAdapter.registerRenter(renter); Assertions.assertEquals(HttpStatus.BAD_REQUEST, httpResponse.getStatus()); }
@Test public void test_registerRenter_returnsCreated() { final RegisterRenterAdapter registerRenterAdapter = new RegisterRenterAdapter( new MockRegisterRenterInputPort()); final Renter renter = new Renter(); renter.setFirstName("John"); renter.setLastName("Doe"); renter.setEmail("john.doe@email.com"); final HttpResponse httpResponse = registerRenterAdapter.registerRenter(renter); Assertions.assertEquals(HttpStatus.CREATED, httpResponse.getStatus()); }
@Test public void test_registerRenter_sameRenter_returnsConflict() { final RegisterRenterAdapter registerRenterAdapter = new RegisterRenterAdapter( new MockRegisterRenterInputPort()); final Renter renter = new Renter(); renter.setFirstName("John"); renter.setLastName("Doe"); renter.setEmail("john.doe@email.com"); HttpResponse httpResponse = registerRenterAdapter.registerRenter(renter); Assertions.assertEquals(HttpStatus.CREATED, httpResponse.getStatus()); httpResponse = registerRenterAdapter.registerRenter(renter); Assertions.assertEquals(HttpStatus.CONFLICT, httpResponse.getStatus()); }