@Test public void testGetDeviceKeyById() { deviceKeySet.add(deviceKey1); expect(mockDeviceKeyService.getDeviceKey(DeviceKeyId.deviceKeyId(deviceKeyId1))) .andReturn(deviceKey1) .anyTimes(); replay(mockDeviceKeyService); WebTarget wt = target(); String response = wt.path("keys/" + deviceKeyId1).request().get(String.class); final JsonObject result = Json.parse(response).asObject(); assertThat(result, notNullValue()); assertThat(result, matchesDeviceKey(deviceKey1)); verify(mockDeviceKeyService); }
@GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) public Response getDeviceKey(@PathParam("id") String id) { DeviceKey deviceKey = nullIsNotFound(get(DeviceKeyService.class).getDeviceKey(DeviceKeyId.deviceKeyId(id)), DEVICE_KEY_NOT_FOUND); return ok(codec(DeviceKey.class).encode(deviceKey, this)).build(); }
DeviceKeyWebResource extends AbstractWebResource { @GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) public Response getDeviceKey(@PathParam("id") String id) { DeviceKey deviceKey = nullIsNotFound(get(DeviceKeyService.class).getDeviceKey(DeviceKeyId.deviceKeyId(id)), DEVICE_KEY_NOT_FOUND); return ok(codec(DeviceKey.class).encode(deviceKey, this)).build(); } }
DeviceKeyWebResource extends AbstractWebResource { @GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) public Response getDeviceKey(@PathParam("id") String id) { DeviceKey deviceKey = nullIsNotFound(get(DeviceKeyService.class).getDeviceKey(DeviceKeyId.deviceKeyId(id)), DEVICE_KEY_NOT_FOUND); return ok(codec(DeviceKey.class).encode(deviceKey, this)).build(); }  }
DeviceKeyWebResource extends AbstractWebResource { @GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) public Response getDeviceKey(@PathParam("id") String id) { DeviceKey deviceKey = nullIsNotFound(get(DeviceKeyService.class).getDeviceKey(DeviceKeyId.deviceKeyId(id)), DEVICE_KEY_NOT_FOUND); return ok(codec(DeviceKey.class).encode(deviceKey, this)).build(); }  @GET @Produces(MediaType.APPLICATION_JSON) Response getDeviceKeys(); @GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) Response getDeviceKey(@PathParam("id") String id); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response addDeviceKey(InputStream stream); @DELETE @Path("{id}") @Produces(MediaType.APPLICATION_JSON) Response removeDeviceKey(@PathParam("id") String id); }
DeviceKeyWebResource extends AbstractWebResource { @GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) public Response getDeviceKey(@PathParam("id") String id) { DeviceKey deviceKey = nullIsNotFound(get(DeviceKeyService.class).getDeviceKey(DeviceKeyId.deviceKeyId(id)), DEVICE_KEY_NOT_FOUND); return ok(codec(DeviceKey.class).encode(deviceKey, this)).build(); }  @GET @Produces(MediaType.APPLICATION_JSON) Response getDeviceKeys(); @GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) Response getDeviceKey(@PathParam("id") String id); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response addDeviceKey(InputStream stream); @DELETE @Path("{id}") @Produces(MediaType.APPLICATION_JSON) Response removeDeviceKey(@PathParam("id") String id);  }