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: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");
}
}
use of jakarta.ws.rs.core.Response.Status in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorStringStatusThrowsIAETest.
/*
* @testName: constructorStringStatusThrowsIAETest
*
* @assertion_ids: JAXRS:JAVADOC:1060;
*
* @test_Strategy: Construct a new client error exception.
* java.lang.IllegalArgumentException - in case the status code is null or if
* it is not from the Response.Status.Family.CLIENT_ERROR status code family.
*/
@Test
public void constructorStringStatusThrowsIAETest() throws Fault {
for (Status status : Status.values()) if (Status.Family.familyOf(status.getStatusCode()) != Status.Family.CLIENT_ERROR)
try {
ClientErrorException e = new ClientErrorException(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);
}
}
use of jakarta.ws.rs.core.Response.Status in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorIntThrowsExceptionTest.
/*
* @testName: constructorIntThrowsExceptionTest
*
* @assertion_ids: JAXRS:JAVADOC:311;
*
* @test_Strategy: Construct a new client error exception.
* java.lang.IllegalArgumentException - in case the status code is not a valid
* HTTP status code or if it is not from the
* Response.Status.Family.CLIENT_ERROR status code family.
*/
@Test
public void constructorIntThrowsExceptionTest() throws Fault {
for (Status status : Status.values()) if (Status.Family.familyOf(status.getStatusCode()) != Status.Family.CLIENT_ERROR)
try {
ClientErrorException e = new ClientErrorException(status.getStatusCode());
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.core.Response.Status in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorIntThrowableThrowsExceptionTest.
/*
* @testName: constructorIntThrowableThrowsExceptionTest
*
* @assertion_ids: JAXRS:JAVADOC:314;
*
* @test_Strategy: Construct a new client error exception.
* java.lang.IllegalArgumentException - in case the status code is not a valid
* HTTP status code or if it is not from the
* Response.Status.Family.CLIENT_ERROR status code family.
*/
@Test
public void constructorIntThrowableThrowsExceptionTest() throws Fault {
for (Status status : Status.values()) if (Status.Family.familyOf(status.getStatusCode()) != Status.Family.CLIENT_ERROR)
try {
ClientErrorException e = new ClientErrorException(status.getStatusCode(), new 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.core.Response.Status in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorStringIntThrowableThrowsIAETest.
/*
* @testName: constructorStringIntThrowableThrowsIAETest
*
* @assertion_ids: JAXRS:JAVADOC:1064;
*
* @test_Strategy: Construct a new client error exception.
* java.lang.IllegalArgumentException - in case the status code is not a valid
* HTTP status code or if it is not from the
* Response.Status.Family.CLIENT_ERROR status code family.
*/
@Test
public void constructorStringIntThrowableThrowsIAETest() throws Fault {
for (Status status : Status.values()) if (Status.Family.familyOf(status.getStatusCode()) != Status.Family.CLIENT_ERROR)
try {
ClientErrorException e = new ClientErrorException(MESSAGE, status.getStatusCode(), new 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);
}
}
Aggregations