use of jakarta.ws.rs.ForbiddenException 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");
}
}
use of jakarta.ws.rs.ForbiddenException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorThrowableTest.
/*
* @testName: constructorThrowableTest
*
* @assertion_ids: JAXRS:JAVADOC:972; JAXRS:JAVADOC:12;
*
* @test_Strategy: Construct a new "forbidden" exception. cause - the
* underlying cause of the exception.
*
* getResponse
*/
@Test
public void constructorThrowableTest() throws Fault {
Throwable[] throwables = new Throwable[] { new RuntimeException(), new IOException(), new Error(), new Throwable() };
for (Throwable t : throwables) {
ForbiddenException e = new ForbiddenException(t);
assertResponse(e);
assertCause(e, t);
}
}
use of jakarta.ws.rs.ForbiddenException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorResponseThrowableTest.
/*
* @testName: constructorResponseThrowableTest
*
* @assertion_ids: JAXRS:JAVADOC:973; JAXRS:JAVADOC:12;
*
* @test_Strategy: Construct a new "forbidden" exception.
* java.lang.IllegalArgumentException - in case the status code set in the
* response is not HTTP 403.
*
* 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) {
ForbiddenException e = new ForbiddenException(response, t);
assertResponse(e, HOST);
assertCause(e, t);
}
}
use of jakarta.ws.rs.ForbiddenException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorTest.
/*
* @testName: constructorTest
*
* @assertion_ids: JAXRS:JAVADOC:970; JAXRS:JAVADOC:12;
*
* @test_Strategy: Construct a new "forbidden" exception.
*
* getResponse
*/
@Test
public void constructorTest() throws Fault {
ForbiddenException e = new ForbiddenException();
assertResponse(e);
}
use of jakarta.ws.rs.ForbiddenException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorStringResponseThrowsIAETest.
/*
* @testName: constructorStringResponseThrowsIAETest
*
* @assertion_ids: JAXRS:JAVADOC:1067;
*
* @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 constructorStringResponseThrowsIAETest() throws Fault {
for (Status status : Status.values()) if (status != STATUS)
try {
Response response = Response.status(status).build();
ForbiddenException e = new ForbiddenException(MESSAGE, response);
fault("IllegalArgumentException has not been thrown; exception", e);
} catch (IllegalArgumentException e) {
logMsg("IllegalArgumentException has been thrown for status", status, "as expected");
}
}
Aggregations