private String givenLinkToService() throws JsonParseException, JsonMappingException, IOException {
    final DomainServiceResource resource = client.getDomainServiceResource();
    final Response response = resource.services();
    final ListRepresentation services =
        RestfulResponse.<ListRepresentation>ofT(response).getEntity();

    final String href = services.getRepresentation("values[id=%s]", "simples").asLink().getHref();
    return href;
  }
  @Test
  public void applicationJson_invalid() throws Exception {

    final String href = givenLinkToService();

    final RestfulRequest request =
        client
            .createRequest(HttpMethod.GET, href)
            .withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
    final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();

    assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
  }
  @Test
  public void applicationJson() throws Exception {

    final String href = givenLinkToService();

    final RestfulRequest request =
        client
            .createRequest(HttpMethod.GET, href)
            .withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
    final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();

    assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
  }