/** Tests the result of the rest api GET for a single subject that is undefined. */
  @Test
  public void testNonExistentConfig() {
    final WebTarget wt = target();

    try {
      final String response =
          wt.path("network/configuration/nosuchkey").request().get(String.class);
      fail("GET of non-existent key does not produce an exception " + response);
    } catch (NotFoundException e) {
      assertThat(e.getResponse().getStatus(), is(HttpURLConnection.HTTP_NOT_FOUND));
    }
  }
 @Override
 public Response toResponse(NotFoundException exception) {
   return Response.status(Response.Status.NOT_FOUND)
       .entity(
           String.format(
               "{\"message\":\"%s\"}",
               StringEscapeUtils.ESCAPE_JSON.translate(exception.getMessage())))
       .type(MediaType.APPLICATION_JSON)
       .build();
 }
 @Override
 public Response toResponse(NotFoundException e) {
   return Response.status(HttpStatus.NOT_FOUND.value())
       .entity(new ErrorWrapper(e.getMessage()))
       .build();
 }