use of jakarta.ws.rs.core.Response.Status in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorResponseThrowsExceptionTest.
/*
* @testName: constructorResponseThrowsExceptionTest
*
* @assertion_ids: JAXRS:JAVADOC:320;
*
* @test_Strategy: Construct a new internal server error exception.
* java.lang.IllegalArgumentException - in case the status code set in the
* response is not HTTP 500.
*/
@Test
public void constructorResponseThrowsExceptionTest() throws Fault {
for (Status status : Status.values()) if (status != STATUS)
try {
Response response = Response.status(status).build();
InternalServerErrorException e = new InternalServerErrorException(response);
fault("No exception has been thrown for status", status, "; exception", e);
} catch (IllegalArgumentException e) {
logMsg("IllegalArgumentException has been thrown as expected for status", status);
}
}
use of jakarta.ws.rs.core.Response.Status in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorStringResponseThrowableThrowsIEATest.
/*
* @testName: constructorStringResponseThrowableThrowsIEATest
*
* @assertion_ids: JAXRS:JAVADOC:1073;
*
* @test_Strategy: Construct a new internal server error exception.
* java.lang.IllegalArgumentException - in case the status code set in the
* response is not HTTP 500.
*/
@Test
public void constructorStringResponseThrowableThrowsIEATest() throws Fault {
for (Status status : Status.values()) if (status != STATUS)
try {
Response response = Response.status(status).build();
InternalServerErrorException e = new InternalServerErrorException(MESSAGE, response, new Throwable());
fault("No exception has been thrown for status", status, "exception", e);
} catch (IllegalArgumentException e) {
logMsg("IllegalArgumentException has been thrown as expected for status", status);
}
}
use of jakarta.ws.rs.core.Response.Status in project jaxrs-api by eclipse-ee4j.
the class ResponseTest method getStatusInfo.
@POST
@Path("statusinfo")
public Response getStatusInfo(String status) {
Status stat = Status.valueOf(status);
Response response = Response.status(stat).build();
return response;
}
use of jakarta.ws.rs.core.Response.Status in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorStringResponseThrowsIAETest.
/*
* @testName: constructorStringResponseThrowsIAETest
*
* @assertion_ids: JAXRS:JAVADOC:1075;
*
* @test_Strategy: Construct a new "request not acceptable" exception.
* java.lang.IllegalArgumentException - in case the status code set in the
* response is not HTTP 406.
*/
@Test
public void constructorStringResponseThrowsIAETest() throws Fault {
for (Status status : Status.values()) if (status != STATUS)
try {
Response response = Response.status(status).build();
NotAcceptableException e = new NotAcceptableException(MESSAGE, response);
fault("IllegalArgumentException has not been thrown; exception", e);
} catch (IllegalArgumentException e) {
logMsg("IllegalArgumentException has been thrown for status", status, "as expected");
}
}
use of jakarta.ws.rs.core.Response.Status in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorResponseThrowsExceptionTest.
/*
* @testName: constructorResponseThrowsExceptionTest
*
* @assertion_ids: JAXRS:JAVADOC:971;
*
* @test_Strategy: Construct a new "forbidden" exception.
* java.lang.IllegalArgumentException - in case the status code set in the
* response is not HTTP 403.
*/
@Test
public void constructorResponseThrowsExceptionTest() throws Fault {
for (Status status : Status.values()) if (status != STATUS)
try {
Response response = Response.status(status).build();
ForbiddenException e = new ForbiddenException(response);
fault("IllegalArgumentException has not been thrown; exception", e);
} catch (IllegalArgumentException e) {
logMsg("IllegalArgumentException has been thrown for status", status, "as expected");
}
}
Aggregations