@Test public void testURI_17_EntitySimpleTypeDollarValue() throws Exception { // create test set FitTestSet testSet = FitTestSet.create(UriType.URI17, "/Employees('1')/Age/$value") .expectedStatusCode(200) .expectedContentType("text/plain; charset=utf-8") .init(); // every combination of $format and $value is a 'BAD REQUEST' testSet.setTestParam( Arrays.asList("?$format=json", "?$format=xml", "?$format=atom"), ACCEPT_HEADER_VALUES, 400, "application/xml"); // final List<String> jsonAcceptHeaders = Arrays.asList("application/json", "application/json; charset=utf-8"); // TODO: check which behavior is currently wanted testSet.setTestParam( Arrays.asList("?$format=json", "?$format=xml", "?$format=atom"), jsonAcceptHeaders, 400, "application/json"); testSet.execute(getEndpoint()); }
@Test public void testURI_8_Metadata() throws Exception { // create test set FitTestSet testSet = FitTestSet.create(UriType.URI8, "/$metadata").init(); // set specific response 'Content-Type's for '$format' testSet.setTestParam( Arrays.asList(""), Arrays.asList("", "application/xml", "application/xml; charset=utf-8"), 200, "application/xml; charset=utf-8"); // set all 'NOT ACCEPTED' requests final List<String> notAcceptedHeaderValues = Arrays.asList( "text/plain", "text/plain; charset=utf-8", "application/atom+xml", "application/atom+xml; charset=utf-8", "application/atomsvc+xml", "application/atomsvc+xml; charset=utf-8"); testSet.setTestParam(Arrays.asList(""), notAcceptedHeaderValues, 406, "application/xml"); // every combination of $format and $metadata is a 'BAD REQUEST' testSet.setTestParam( Arrays.asList("?$format=json", "?$format=xml", "?$format=atom"), ACCEPT_HEADER_VALUES, 400, "application/xml"); // final List<String> jsonAcceptHeaders = Arrays.asList("application/json", "application/json; charset=utf-8"); // TODO: check which behavior is currently wanted testSet.setTestParam( Arrays.asList("?$format=json", "?$format=xml", "?$format=atom"), jsonAcceptHeaders, 400, "application/json"); testSet.setTestParam(Arrays.asList(""), jsonAcceptHeaders, 406, "application/json"); // execute all defined tests testSet.execute(getEndpoint()); }
@Test public void testURI_7A_EntityNavigationProperty() throws Exception { // create test set FitTestSet testSet = FitTestSet.create(UriType.URI7A, "/Employees('1')/$links/ne_Room").init(); // set specific response 'Content-Type's for '$format' testSet.setTestParam( Arrays.asList("?$format=xml"), ACCEPT_HEADER_VALUES, 200, "application/xml; charset=utf-8"); testSet.setTestParam( Arrays.asList(""), Arrays.asList(""), 200, "application/xml; charset=utf-8"); // set all 'NOT ACCEPTED' requests final List<String> notAcceptedHeaderValues = Arrays.asList( "text/plain", "text/plain; charset=utf-8", "application/atom+xml", "application/atom+xml; charset=utf-8", "application/atomsvc+xml", "application/atomsvc+xml; charset=utf-8"); testSet.setTestParam(Arrays.asList(""), notAcceptedHeaderValues, 406, "application/xml"); // final List<String> notAcceptedJsonHeaderValues = Arrays.asList("application/json", "application/json; charset=utf-8"); // TODO: check which behavior is currently wanted testSet.setTestParam( Arrays.asList("?$format=json", "?$format=atom"), ACCEPT_HEADER_VALUES, 406, "application/xml"); testSet.setTestParam( Arrays.asList("", "?$format=json", "?$format=atom"), notAcceptedJsonHeaderValues, 406, "application/json"); // execute all defined tests testSet.execute(getEndpoint()); }