@Before public void setUp() throws Exception { final WebServer webServer = webServerRule.getWebServer(); client = new RestfulClient(webServer.getBase()); resource = client.getVersionResource(); }
@Test public void applicationJson_profileIncorrect_returns406() throws Exception { // given final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "user"); request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.VERSION.getMediaType()); // when final RestfulResponse<UserRepresentation> restfulResponse = request.executeT(); // then assertThat(restfulResponse.getStatus(), is(RestfulResponse.HttpStatusCode.NOT_ACCEPTABLE)); }
@Test public void incorrectMediaType_returns406() throws Exception { // given final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("user"); clientRequest.accept(MediaType.APPLICATION_ATOM_XML_TYPE); // when final ClientResponse<?> resp = clientRequest.get(); final RestfulResponse<JsonRepresentation> restfulResponse = RestfulResponse.of(resp); // then assertThat(restfulResponse.getStatus(), is(RestfulResponse.HttpStatusCode.NOT_ACCEPTABLE)); }
@Before public void setUp() throws Exception { client = webServerRule.getClient(); resource = client.getDomainServiceResource(); }
@Before public void setUp() throws Exception { client = webServerRule.getClient(); request = client.createRequest(RestfulHttpMethod.GET, "services"); }