### Question:
PowerstateService { @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public Response getPowerstate(@PathParam("id") String id) { Response response = null; UUID uuid = null; PowerSwitch ps = null; logRequest("", id); response = ElisResponseBuilder.buildBadRequestResponse(); try { uuid = UUID.fromString(id); } catch (Exception e) { log(LogService.LOG_WARNING, "Bad UUID"); } if (userService != null && storage != null && uuid != null) { if (storage.objectExists(uuid)) { try { ps = (PowerSwitch) storage.readData(uuid); PowerstateBean bean = new PowerstateBean(); bean.device = uuid; bean.powerstate = ps.isTurnedOn(); response = ElisResponseBuilder.buildOKResponse(bean); } catch (StorageException | ClassCastException e) { log(LogService.LOG_INFO, "Tried to perform a getPowerstate on a non-power switch object: " + uuid); response = ElisResponseBuilder.buildMethodNotAllowedResponse(); } catch (ActuatorFailedException e) { log(LogService.LOG_WARNING, "Couldn't read device status from: " + uuid); response = ElisResponseBuilder.buildServiceUnavailableResponse(); } } else { response = ElisResponseBuilder.buildNotFoundResponse(); } } return response; } PowerstateService();  PowerstateService(UserService us, Storage storage,
			LogService log, EndpointUtils utils); @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) Response getPowerstate(@PathParam("id") String id); @PUT @Path("/{id}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response setPowerstate(@PathParam("id") String id,
			PowerstateBean bean);  }### Answer:
@Test public void testGetPowerstate() { final String deviceResponse = target("/powerstate/" + DID).request().get(String.class); EnvelopeBean envelope = gson.fromJson(deviceResponse, EnvelopeBean.class); PowerstateBean bean = gson.fromJson(gson.toJson(envelope.response), PowerstateBean.class); assertEquals(DID, bean.device); assertTrue(bean.powerstate); }