@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 ok() throws Exception { // given final Response resp = resource.user(); // when final RestfulResponse<UserRepresentation> restfulResponse = RestfulResponse.ofT(resp); // then final MediaType contentType = restfulResponse.getHeader(Header.CONTENT_TYPE); assertThat(contentType, hasMediaType("application")); assertThat(contentType, hasSubType("json")); assertThat(contentType, hasParameter("profile", "urn:org.restfulobjects:repr-types/user")); assertThat(contentType, is(RepresentationType.USER.getMediaType())); }