### Question:
RestEntityServiceBase extends RestServiceBase { @DELETE @Path("/{id}") public Object delete(@PathParam("id") @AuditId String id) { if ((id = SearchUtils.trimToNull(id)) == null) { throw new RequiredFieldException("id"); } entityService.delete(id); return Response.ok().build(); }  @GET @Path("/") @Produces(MediaType.APPLICATION_JSON) @AuditIgnore Object getAll(@QueryParam("from") Integer from, @QueryParam("size") Integer size); @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) @AuditIgnore Object get(@PathParam("id") @AuditId String id); @POST @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Object create(@AuditContent Map<String, Object> data); @POST @Path("/{id}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Object create(@PathParam("id") @AuditId String id, @AuditContent Map<String, Object> data); @DELETE @Path("/{id}") Object delete(@PathParam("id") @AuditId String id);  }### Answer:
@Test(expected = RequiredFieldException.class) public void delete_inputParamValidation_1() { RestEntityServiceBase tested = getTested(); TestUtils.assertResponseStatus(tested.delete(null), Status.BAD_REQUEST); }
@Test(expected = RequiredFieldException.class) public void delete_inputParamValidation_2() { RestEntityServiceBase tested = getTested(); TestUtils.assertResponseStatus(tested.delete(""), Status.BAD_REQUEST); }
@Test public void delete() { RestEntityServiceBase tested = getTested(); { Response r = (Response) tested.delete("12"); Assert.assertEquals(Status.OK.getStatusCode(), r.getStatus()); Mockito.verify(tested.entityService).delete("12"); Mockito.verifyNoMoreInteractions(tested.entityService); } { Mockito.reset(tested.entityService); Mockito.doThrow(new RuntimeException("my exception")).when(tested.entityService).delete("12"); try { tested.delete("12"); Assert.fail("RuntimeException expected"); } catch (RuntimeException e) { Mockito.verify(tested.entityService).delete("12"); Mockito.verifyNoMoreInteractions(tested.entityService); } } }