@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();
    }
@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);
    }