### Question:
EvseResource { @PUT @Path("/{id: [0-9]+}") @Consumes(ApiVersion.V1_JSON) public Response updateEvse(@PathParam("chargingStationTypeId") Long chargingStationTypeId, @PathParam("id") Long id, Evse evse) { evse.setId(id); return Response.ok(domainService.updateEvse(chargingStationTypeId, evse)).build(); }  @GET Response getEvses(@PathParam("chargingStationTypeId") Long chargingStationTypeId); @POST @Consumes(ApiVersion.V1_JSON) Response createEvse(@PathParam("chargingStationTypeId") Long chargingStationTypeId, Evse evse); @PUT @Path("/{id: [0-9]+}") @Consumes(ApiVersion.V1_JSON) Response updateEvse(@PathParam("chargingStationTypeId") Long chargingStationTypeId, @PathParam("id") Long id, Evse evse); @GET @Path("/{id: [0-9]+}") Response getEvse(@PathParam("chargingStationTypeId") Long chargingStationTypeId, @PathParam("id") Long id); @DELETE @Path("/{id: [0-9]+}") Response deleteEvse(@PathParam("chargingStationTypeId") Long chargingStationTypeId, @PathParam("id") Long id); void setDomainService(DomainService domainService);  }### Answer:
@Test public void testUpdateEvse() { Evse evse = mock(Evse.class); Response response = resource.updateEvse(CHARGING_STATION_TYPE_ID, EVSE_ID, evse); verify(domainService).updateEvse(CHARGING_STATION_TYPE_ID, evse); assertNotNull(response); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); }
@Test(expected = RuntimeException.class) public void testUpdateEvseThrowsException() { Evse evse = mock(Evse.class); doThrow(mock(PersistenceException.class)).when(domainService).updateEvse(CHARGING_STATION_TYPE_ID, evse); resource.updateEvse(CHARGING_STATION_TYPE_ID, EVSE_ID, evse); }