use of jakarta.ws.rs.ServerErrorException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorIntTest.
/*
* @testName: constructorIntTest
*
* @assertion_ids: JAXRS:JAVADOC:352; JAXRS:JAVADOC:12;
*
* @test_Strategy: Construct a new server error exception.
* java.lang.IllegalArgumentException - in case the status code is not a valid
* HTTP status code or is not from Response.Status.Family.SERVER_ERROR status
* code family.
*
* getResponse
*/
@Test
public void constructorIntTest() throws Fault {
for (Status status : getStatusesFromFamily()) {
ServerErrorException e = new ServerErrorException(status.getStatusCode());
assertResponse(e, status);
}
}
use of jakarta.ws.rs.ServerErrorException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorStatusThrowableThrowsExceptionTest.
/*
* @testName: constructorStatusThrowableThrowsExceptionTest
*
* @assertion_ids: JAXRS:JAVADOC:354;
*
* @test_Strategy: Construct a new server error exception.
* java.lang.IllegalArgumentException - in case the status code is null or is
* not from Response.Status.Family.SERVER_ERROR status code family.
*/
@Test
public void constructorStatusThrowableThrowsExceptionTest() throws Fault {
Throwable throwable = new Throwable();
for (Status status : getStatusesOutsideFamily()) {
try {
ServerErrorException e = new ServerErrorException(status, throwable);
fault("IllegalArgumentException has not 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.ServerErrorException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorResponseTest.
/*
* @testName: constructorResponseTest
*
* @assertion_ids: JAXRS:JAVADOC:353; JAXRS:JAVADOC:12;
*
* @test_Strategy: Construct a new server error exception.
* java.lang.IllegalArgumentException - in case the response status code is
* not from the Response.Status.Family.SERVER_ERROR status code family.
*
* getResponse
*/
@Test
public void constructorResponseTest() throws Fault {
for (Status status : getStatusesFromFamily()) {
ServerErrorException e = new ServerErrorException(buildResponse(status));
assertResponse(e, status, HOST);
}
}
use of jakarta.ws.rs.ServerErrorException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorIntNotValidStatusThrowsExceptionTest.
/*
* @testName: constructorIntNotValidStatusThrowsExceptionTest
*
* @assertion_ids: JAXRS:JAVADOC:352;
*
* @test_Strategy: Construct a new server error exception.
* java.lang.IllegalArgumentException - in case the status code is not a valid
* HTTP status code or is not from Response.Status.Family.SERVER_ERROR status
* code family.
*/
@Test
public void constructorIntNotValidStatusThrowsExceptionTest() throws Fault {
for (int status : new int[] { -1, Integer.MAX_VALUE, Integer.MIN_VALUE }) {
try {
ServerErrorException e = new ServerErrorException(status);
fault("IllegalArgumentException has not 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.ServerErrorException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorStringStatusThrowsIAETest.
/*
* @testName: constructorStringStatusThrowsIAETest
*
* @assertion_ids: JAXRS:JAVADOC:1098;
*
* @test_Strategy: Construct a new server error exception.
* java.lang.IllegalArgumentException - in case the status code is null or is
* not from Response.Status.Family.SERVER_ERROR status code family.
*/
@Test
public void constructorStringStatusThrowsIAETest() throws Fault {
for (Status status : getStatusesOutsideFamily()) {
try {
ServerErrorException e = new ServerErrorException(MESSAGE, status);
fault("IllegalArgumentException has not been thrown for status", status, "; exception", e);
} catch (IllegalArgumentException e) {
logMsg("IllegalArgumentException has been thrown as expected for status", status);
}
}
}
Aggregations