@Test public void simple_rejected() throws Exception { request.withArg(RequestParameter.DOMAIN_MODEL, "simple"); final RestfulResponse<ListRepresentation> restfulResponse = request.executeT(); assertThat(restfulResponse.getStatus(), is(HttpStatusCode.BAD_REQUEST)); assertThat( restfulResponse.getHeader(RestfulResponse.Header.WARNING), is("x-ro-domain-model of 'simple' is not supported")); }
@Test public void ok() throws Exception { // given final Response resp = resource.version(); // when final RestfulResponse<VersionRepresentation> restfulResponse = RestfulResponse.ofT(resp); // then final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL); assertThat(cacheControl, hasMaxAge(24 * 60 * 60)); assertThat(cacheControl.getMaxAge(), is(24 * 60 * 60)); }
@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())); }