use of jakarta.ws.rs.core.Response.StatusType in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getFamilyTest.
/* Run test */
/*
* @testName: getFamilyTest
*
* @assertion_ids: JAXRS:JAVADOC:302;
*
* @test_Strategy: Get the class of status code
*/
@Test
public void getFamilyTest() throws Fault {
Response response;
for (int i = 0; i != status_codes.length; i++) {
response = Response.status(status_codes[i]).build();
StatusType type = response.getStatusInfo();
Family family = type.getFamily();
assertTrue(family == status_family[i], "unexpected family " + family + " differs from " + status_family[i]);
logMsg("Found expected family", family, "for status", status_codes[i]);
}
}
use of jakarta.ws.rs.core.Response.StatusType in project jaxrs-api by eclipse-ee4j.
the class ResponseFilter method getStatusInfo.
public void getStatusInfo() {
StatusType type = responseContext.getStatusInfo();
if (type == null) {
setEntity(NULL);
responseContext.setStatus(Status.OK.getStatusCode());
return;
}
int status = type.getStatusCode();
responseContext.setStatus(Status.OK.getStatusCode());
setEntity(String.valueOf(status));
}
use of jakarta.ws.rs.core.Response.StatusType in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getStatusCodeTest.
/*
* @testName: getStatusCodeTest
*
* @assertion_ids: JAXRS:JAVADOC:304;
*
* @test_Strategy: Get the associated status code.
*/
@Test
public void getStatusCodeTest() throws Fault {
Response response;
for (int i = 0; i != status_codes.length; i++) {
response = Response.status(status_codes[i]).build();
StatusType type = response.getStatusInfo();
int code = type.getStatusCode();
assertTrue(code == status_codes[i], "unexpected status code " + code + " differs from " + status_codes[i]);
logMsg("Found expected status code", code, "for status", status_codes[i]);
}
}
use of jakarta.ws.rs.core.Response.StatusType in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getReasonPhraseTest.
/*
* @testName: getReasonPhraseTest
*
* @assertion_ids: JAXRS:JAVADOC:303;
*
* @test_Strategy: Get the reason phrase
*/
@Test
public void getReasonPhraseTest() throws Fault {
Response response;
for (int i = 0; i != status_codes.length; i++) {
response = Response.status(status_codes[i]).build();
StatusType type = response.getStatusInfo();
String phrase = type.getReasonPhrase();
assertTrue(phrase.equals(status[i]), "unexpected phrase " + phrase + " differs from " + status[i]);
logMsg("Found expected phrase", phrase, "for status", status_codes[i]);
}
}
use of jakarta.ws.rs.core.Response.StatusType in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getStatusInfoTest.
/*
* @testName: getStatusInfoTest
*
* @assertion_ids: JAXRS:JAVADOC:858;
*
* @test_Strategy: Get the complete status information associated with the
* response.
*/
@Test
public void getStatusInfoTest() throws Fault {
for (Status status : Status.values()) {
Response response = Response.status(status).build();
StatusType info = response.getStatusInfo();
assertTrue(info.getStatusCode() == status.getStatusCode(), "#getStatusInfo returned unexpected value" + info);
}
logMsg("#getStatusInfo returned expected StatusTypes");
}
Aggregations