### Question:
ManufacturerResource { @POST @Consumes(ApiVersion.V1_JSON) public Response createManufacturer(Manufacturer manufacturer) { manufacturer.setId(null); return Response.status(Response.Status.CREATED).entity(domainService.createManufacturer(manufacturer)).build(); }  @POST @Consumes(ApiVersion.V1_JSON) Response createManufacturer(Manufacturer manufacturer); @PUT @Path("/{id: [0-9]+}") @Consumes(ApiVersion.V1_JSON) Response updateManufacturer(@PathParam("id") Long id, Manufacturer manufacturer); @GET Response getManufacturers(@Context HttpServletRequest request, @QueryParam(OFFSET_PARAMETER) @DefaultValue(OFFSET_DEFAULT) int offset, @QueryParam(LIMIT_PARAMETER) @DefaultValue(LIMIT_DEFAULT) int limit); @GET @Path("/{id: [0-9]+}") Response getManufacturer(@PathParam("id") Long id); @DELETE @Path("/{id: [0-9]+}") Response deleteManufacturer(@PathParam("id") Long id); void setDomainService(DomainService domainService);  }### Answer:
@Test public void testCreateManufacturer() { Manufacturer manufacturer = mock(Manufacturer.class); Response response = resource.createManufacturer(manufacturer); verify(repository).createOrUpdate(manufacturer); assertNotNull(response); assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); }
@Test(expected = RuntimeException.class) public void testCreateManufacturerThrowsException() { Manufacturer manufacturer = mock(Manufacturer.class); doThrow(mock(PersistenceException.class)).when(repository).createOrUpdate(manufacturer); resource.createManufacturer(manufacturer); }