use of jakarta.ws.rs.BadRequestException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorResponseThrowableTest.
/*
* @testName: constructorResponseThrowableTest
*
* @assertion_ids: JAXRS:JAVADOC:308; JAXRS:JAVADOC:12;
*
* @test_Strategy: Construct a new bad client request exception. throws -
* java.lang.IllegalArgumentException - in case the status code set in the
* response is not HTTP 400.
*
* getResponse
*/
@Test
public void constructorResponseThrowableTest() throws Fault {
Throwable[] throwables = new Throwable[] { new RuntimeException(), new IOException(), new Error(), new Throwable() };
Response response = buildResponse();
for (Throwable throwable : throwables) {
BadRequestException e = new BadRequestException(response, throwable);
assertResponse(e, HOST);
assertCause(e, throwable);
}
}
use of jakarta.ws.rs.BadRequestException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorStringResponseTest.
/*
* @testName: constructorStringResponseTest
*
* @assertion_ids: JAXRS:JAVADOC:1057;
*
* @test_Strategy: message - the detail message (which is saved for later
* retrieval by the Throwable.getMessage() method).
*/
@Test
public void constructorStringResponseTest() throws Fault {
Response response = buildResponse();
BadRequestException e = new BadRequestException(MESSAGE, response);
assertResponse(e, HOST);
assertMessage(e);
}
use of jakarta.ws.rs.BadRequestException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorStringRequestThrowableTest.
/*
* @testName: constructorStringRequestThrowableTest
*
* @assertion_ids: JAXRS:JAVADOC:1059;
*
* @test_Strategy: Construct a new bad client request exception.
*/
@Test
public void constructorStringRequestThrowableTest() throws Fault {
Throwable[] throwables = new Throwable[] { new RuntimeException(), new IOException(), new Error(), new Throwable() };
Response response = buildResponse();
for (Throwable throwable : throwables) {
BadRequestException e = new BadRequestException(MESSAGE, response, throwable);
assertMessage(e);
assertCause(e, throwable);
assertResponse(e, HOST);
}
}
use of jakarta.ws.rs.BadRequestException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorStringTest.
/*
* @testName: constructorStringTest
*
* @assertion_ids: JAXRS:JAVADOC:1056;
*
* @test_Strategy: message - the detail message (which is saved for later
* retrieval by the Throwable.getMessage() method).
*/
@Test
public void constructorStringTest() throws Fault {
BadRequestException e = new BadRequestException(MESSAGE);
assertMessage(e);
assertResponse(e);
}
use of jakarta.ws.rs.BadRequestException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorResponseThrowsExceptionTest.
/*
* @testName: constructorResponseThrowsExceptionTest
*
* @assertion_ids: JAXRS:JAVADOC:306;
*
* @test_Strategy: Construct a new bad client request exception. throws -
* java.lang.IllegalArgumentException - in case the status code set in the
* response is not HTTP 400.
*/
@Test
public void constructorResponseThrowsExceptionTest() throws Fault {
for (Status status : Status.values()) if (status != STATUS)
try {
Response response = Response.status(status).build();
BadRequestException e = new BadRequestException(response);
fault("Exception has been not been thrown for response with status", status, "; exception", e);
} catch (IllegalArgumentException e) {
logMsg("IllegalArgumentException has been thrown for status", status, "as expected");
}
}
Aggregations