Search in sources :

Example 6 with ForbiddenException

use of jakarta.ws.rs.ForbiddenException in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method constructorStringResponseTest.

/*
   * @testName: constructorStringResponseTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1067; JAXRS:JAVADOC:12;
   * 
   * @test_Strategy: Construct a new "forbidden" exception. getResponse
   */
@Test
public void constructorStringResponseTest() throws Fault {
    Response response = buildResponse();
    ForbiddenException e = new ForbiddenException(MESSAGE, response);
    assertResponse(e, HOST);
    assertMessage(e);
}
Also used : Response(jakarta.ws.rs.core.Response) ForbiddenException(jakarta.ws.rs.ForbiddenException) Test(org.junit.jupiter.api.Test)

Example 7 with ForbiddenException

use of jakarta.ws.rs.ForbiddenException in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method constructorStringTest.

/*
   * @testName: constructorStringTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1066; JAXRS:JAVADOC:12;
   * 
   * @test_Strategy: Construct a new "forbidden" exception. getResponse
   */
@Test
public void constructorStringTest() throws Fault {
    ForbiddenException e = new ForbiddenException(MESSAGE);
    assertResponse(e);
    assertMessage(e);
}
Also used : ForbiddenException(jakarta.ws.rs.ForbiddenException) Test(org.junit.jupiter.api.Test)

Example 8 with ForbiddenException

use of jakarta.ws.rs.ForbiddenException in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method constructorStringThrowableTest.

/*
   * @testName: constructorStringThrowableTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1068; JAXRS:JAVADOC:12;
   * 
   * @test_Strategy: Construct a new "forbidden" exception. cause - the
   * underlying cause of the exception.
   * 
   * getResponse
   */
@Test
public void constructorStringThrowableTest() throws Fault {
    Throwable[] throwables = new Throwable[] { new RuntimeException(), new IOException(), new Error(), new Throwable() };
    for (Throwable t : throwables) {
        ForbiddenException e = new ForbiddenException(MESSAGE, t);
        assertResponse(e);
        assertCause(e, t);
        assertMessage(e);
    }
}
Also used : ForbiddenException(jakarta.ws.rs.ForbiddenException) IOException(java.io.IOException) Test(org.junit.jupiter.api.Test)

Example 9 with ForbiddenException

use of jakarta.ws.rs.ForbiddenException in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method constructorResponseTest.

/*
   * @testName: constructorResponseTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:971; 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 constructorResponseTest() throws Fault {
    Response response = buildResponse();
    ForbiddenException e = new ForbiddenException(response);
    assertResponse(e, HOST);
}
Also used : Response(jakarta.ws.rs.core.Response) ForbiddenException(jakarta.ws.rs.ForbiddenException) Test(org.junit.jupiter.api.Test)

Example 10 with ForbiddenException

use of jakarta.ws.rs.ForbiddenException in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method constructorStringResponseThrowableTest.

/*
   * @testName: constructorStringResponseThrowableTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1069; JAXRS:JAVADOC:12;
   * 
   * @test_Strategy: Construct a new "forbidden" exception.
   * 
   * getResponse
   */
@Test
public void constructorStringResponseThrowableTest() 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(MESSAGE, response, t);
        assertResponse(e, HOST);
        assertCause(e, t);
        assertMessage(e);
    }
}
Also used : Response(jakarta.ws.rs.core.Response) ForbiddenException(jakarta.ws.rs.ForbiddenException) IOException(java.io.IOException) Test(org.junit.jupiter.api.Test)

Aggregations

ForbiddenException (jakarta.ws.rs.ForbiddenException)10 Test (org.junit.jupiter.api.Test)10 Response (jakarta.ws.rs.core.Response)6 IOException (java.io.IOException)4 Status (jakarta.ws.rs.core.Response.Status)2