use of ee.jakarta.tck.ws.rs.api.rs.core.responseclient.VerificationResult in project jaxrs-api by eclipse-ee4j.
the class BuilderClientIT method statusTest2.
/*
* @testName: statusTest2
*
* @assertion_ids: JAXRS:JAVADOC:131; JAXRS:JAVADOC:154; JAXRS:JAVADOC:141;
* JAXRS:JAVADOC:123; JAXRS:JAVADOC:124; JAXRS:JAVADOC:125;
*
* @test_Strategy: Create an instance of ResponseBuilder Response.ok();
* Setting status using ResponseBuilder.status(Status); verify that correct
* status code is returned
*/
@Test
public void statusTest2() throws Fault {
VerificationResult result = new VerificationResult();
Response resp = null;
ResponseBuilder respb = null;
for (int i = 0; i < status_codes.length - 1; i++) {
respb = Response.ok();
respb = respb.status(resp_status[i]);
resp = respb.build();
result.append(verifyStatus(resp, status_codes[i]));
}
logMsg(result);
assertTrue(result.pass);
}
use of ee.jakarta.tck.ws.rs.api.rs.core.responseclient.VerificationResult in project jaxrs-api by eclipse-ee4j.
the class BuilderClientIT method statusTest1.
/*
* @testName: statusTest1
*
* @assertion_ids: JAXRS:JAVADOC:131; JAXRS:JAVADOC:153; JAXRS:JAVADOC:141;
* JAXRS:JAVADOC:123; JAXRS:JAVADOC:125; JAXRS:JAVADOC:124;
*
* @test_Strategy: Create an instance of ResponseBuilder Response.ok();
* Setting status using ResponseBuilder.status(int); verify that correct
* status code is returned
*/
@Test
public void statusTest1() throws Fault {
VerificationResult result = new VerificationResult();
Response resp = null;
ResponseBuilder respb = null;
for (int status : status_codes) {
respb = Response.ok();
respb = respb.status(status);
resp = respb.build();
result.append(verifyStatus(resp, status));
}
logMsg(result);
assertTrue(result.pass);
}
use of ee.jakarta.tck.ws.rs.api.rs.core.responseclient.VerificationResult in project jaxrs-api by eclipse-ee4j.
the class BuilderClientIT method variantsTest.
/*
* @testName: variantsTest
*
* @assertion_ids: JAXRS:JAVADOC:884;
*
* @test_Strategy: Add a Vary header that lists the available variants.
*/
@Test
public void variantsTest() throws Fault {
List<String> encoding = Arrays.asList("gzip", "compress");
List<String> vars = Arrays.asList(HttpHeaders.ACCEPT_LANGUAGE, HttpHeaders.ACCEPT_ENCODING);
MediaType mt = MediaType.APPLICATION_JSON_TYPE;
ResponseBuilder rb = Response.ok();
rb = rb.variants(getVariantList(encoding, mt).toArray(new Variant[0]));
Response response = rb.build();
VerificationResult result = new VerificationResult();
result.append(verifyVary(response, vars));
logMsg(result.message);
assertTrue(result.pass);
}
use of ee.jakarta.tck.ws.rs.api.rs.core.responseclient.VerificationResult in project jaxrs-api by eclipse-ee4j.
the class BuilderClientIT method encodingTest.
/*
* @testName: encodingTest
*
* @assertion_ids: JAXRS:JAVADOC:878;
*
* @test_Strategy: Set the message entity content encoding.
*/
@Test
public void encodingTest() throws Fault {
String[] encodings = { "gzip", "ccitt", "pic" };
VerificationResult vr = new VerificationResult();
for (String encoding : encodings) {
Response response = Response.ok().encoding(encoding).build();
vr.append(verifyEncoding(response, Collections.singletonList(encoding)));
}
logMsg(vr.message);
assertTrue(vr.pass);
logMsg("Found expected encodings");
}
Aggregations