### Question:
RecordsAccessor { public void removeRecord(String id, String type) throws MissingArgumentsException, DoesNotExistException, InternalServerErrorException { WebTarget target = client.target(restUrl + "/" + RecordOptionListContainer.RECORDS).queryParam("recordId", id).queryParam("type", type); Response response = target.request(MediaType.APPLICATION_JSON).delete(); switch (response.getStatus()) { case 404: Result errorMessage = response.readEntity(Result.class); LOGGER.warn("removeRecord(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); case 406: errorMessage = response.readEntity(Result.class); LOGGER.warn("removeRecord(..) failure! : " + errorMessage.getResult()); throw new MissingArgumentsException(errorMessage.getResult()); case 500: errorMessage = response.readEntity(Result.class); LOGGER.warn("removeRecord(..) failure! : " + errorMessage.getResult()); throw new InternalServerErrorException(errorMessage.getResult()); } Result result = response.readEntity(Result.class); LOGGER.info("removeRecord(..) success! : " + result.getResult()); } RecordsAccessor(URL restUrl, String username, String password);   RecordsAccessor(URL restUrl, String username, String password, Client client); String getRecord(String id); void removeRecord(String id, String type); void createRecord(String datasetId, String recordId, String record);  }### Answer:
@Test public void testRemoveRecord() throws InternalServerErrorException, InvalidArgumentsException, DoesNotExistException, MissingArgumentsException, AlreadyExistsException { Mockito.when(response.getStatus()).thenReturn(200); ra.removeRecord("recordId", RecordOptionListContainer.DELETE); }
@Test(expected = DoesNotExistException.class) public void testRemoveRecordDoesNotExist() throws InternalServerErrorException, InvalidArgumentsException, DoesNotExistException, MissingArgumentsException, AlreadyExistsException { Mockito.when(response.getStatus()).thenReturn(404); Mockito.when(response.readEntity(Result.class)).thenReturn(new Result("Does not exist!")); ra.removeRecord("recordId", RecordOptionListContainer.DELETE); }
@Test(expected = MissingArgumentsException.class) public void testRemoveRecordMissingArguments() throws InternalServerErrorException, InvalidArgumentsException, DoesNotExistException, MissingArgumentsException, AlreadyExistsException { Mockito.when(response.getStatus()).thenReturn(406); Mockito.when(response.readEntity(Result.class)).thenReturn(new Result("Missing argument!")); ra.removeRecord("recordId", RecordOptionListContainer.DELETE); }
@Test(expected = InternalServerErrorException.class) public void testRemoveRecordInternalServerError() throws InternalServerErrorException, InvalidArgumentsException, DoesNotExistException, MissingArgumentsException, AlreadyExistsException { Mockito.when(response.getStatus()).thenReturn(500); Mockito.when(response.readEntity(Result.class)) .thenReturn(new Result("Internal Server Error!")); ra.removeRecord("recordId", RecordOptionListContainer.DELETE); }