use of org.apache.syncope.common.rest.api.service.AnyTypeClassService in project syncope by apache.
the class RESTITCase method defaultContentType.
@Test
public void defaultContentType() {
// manualy instantiate SyncopeClient so that media type can be set to */*
SyncopeClientFactoryBean factory = new SyncopeClientFactoryBean().setAddress(ADDRESS);
SyncopeClient client = new SyncopeClient(MediaType.WILDCARD_TYPE, factory.getRestClientFactoryBean(), factory.getExceptionMapper(), new BasicAuthenticationHandler(ADMIN_UNAME, ADMIN_PWD), false);
// perform operation
AnyTypeClassService service = client.getService(AnyTypeClassService.class);
service.list();
// check that */* was actually sent
MultivaluedMap<String, String> requestHeaders = WebClient.client(service).getHeaders();
assertEquals(MediaType.WILDCARD, requestHeaders.getFirst(HttpHeaders.ACCEPT));
// check that application/json was received
String contentType = WebClient.client(service).getResponse().getHeaderString(HttpHeaders.CONTENT_TYPE);
assertTrue(contentType.startsWith(MediaType.APPLICATION_JSON));
}
Aggregations