use of jakarta.ws.rs.InternalServerErrorException 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.InternalServerErrorException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorStringThrowableTest.
/*
* @testName: constructorStringThrowableTest
*
* @assertion_ids: JAXRS:JAVADOC:1072; JAXRS:JAVADOC:12;
*
* @test_Strategy: Construct a new internal server error exception.
*
* getResponse
*/
@Test
public void constructorStringThrowableTest() throws Fault {
Throwable[] throwables = new Throwable[] { new RuntimeException(), new IOException(), new Error(), new Throwable() };
for (Throwable t : throwables) {
InternalServerErrorException e = new InternalServerErrorException(MESSAGE, t);
assertResponse(e);
assertCause(e, t);
assertMessage(e);
}
}
use of jakarta.ws.rs.InternalServerErrorException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorStringResponseTest.
/*
* @testName: constructorStringResponseTest
*
* @assertion_ids: JAXRS:JAVADOC:1071; JAXRS:JAVADOC:12;
*
* @test_Strategy: Construct a new internal server error exception.
*
* getResponse
*/
@Test
public void constructorStringResponseTest() throws Fault {
Response response = buildResponse();
InternalServerErrorException e = new InternalServerErrorException(MESSAGE, response);
assertResponse(e, HOST);
assertMessage(e);
}
use of jakarta.ws.rs.InternalServerErrorException 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.InternalServerErrorException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorResponseThrowableTest.
/*
* @testName: constructorResponseThrowableTest
*
* @assertion_ids: JAXRS:JAVADOC:322; JAXRS:JAVADOC:12;
*
* @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.
*
* getResponse
*/
@Test
public void constructorResponseThrowableTest() throws Fault {
Response response = buildResponse();
Throwable[] throwables = new Throwable[] { new RuntimeException(), new IOException(), new Error(), new Throwable() };
for (Throwable t : throwables) {
InternalServerErrorException e = new InternalServerErrorException(response, t);
assertResponse(e, HOST);
assertCause(e, t);
}
}
Aggregations