Search in sources :

Example 31 with Status

use of jakarta.ws.rs.core.Response.Status in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method constructorStringStatusUriTest.

/*
   * @testName: constructorStringStatusUriTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1095; JAXRS:JAVADOC:347; JAXRS:JAVADOC:12;
   * 
   * @test_Strategy: Construct a new redirection exception.
   * java.lang.IllegalArgumentException - in case the status code is null or is
   * not from Response.Status.Family.REDIRECTION status code family.
   * 
   * Get the redirection response location.
   * 
   * getResponse
   */
@Test
public void constructorStringStatusUriTest() throws Fault {
    for (Status status : getStatusesFromFamily()) {
        RedirectionException e = new RedirectionException(MESSAGE, status, LOCATION);
        assertResponse(e, status);
        assertLocation(e, LOCATION);
        assertMessage(e);
    }
}
Also used : Status(jakarta.ws.rs.core.Response.Status) RedirectionException(jakarta.ws.rs.RedirectionException) Test(org.junit.jupiter.api.Test)

Example 32 with Status

use of jakarta.ws.rs.core.Response.Status in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method constructorStringIntUriTest.

/*
   * @testName: constructorStringIntUriTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1096; JAXRS:JAVADOC:347; JAXRS:JAVADOC:12;
   * 
   * @test_Strategy: Construct a new redirection exception.
   * java.lang.IllegalArgumentException - in case the status code is not a valid
   * HTTP status code or is not from Response.Status.Family.REDIRECTION status
   * code family.
   * 
   * Get the redirection response location.
   * 
   * getResponse
   */
@Test
public void constructorStringIntUriTest() throws Fault {
    for (Status status : getStatusesFromFamily()) {
        RedirectionException e = new RedirectionException(MESSAGE, status.getStatusCode(), LOCATION);
        assertResponse(e, status);
        assertLocation(e, LOCATION);
        assertMessage(e);
    }
}
Also used : Status(jakarta.ws.rs.core.Response.Status) RedirectionException(jakarta.ws.rs.RedirectionException) Test(org.junit.jupiter.api.Test)

Example 33 with Status

use of jakarta.ws.rs.core.Response.Status in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method constructorIntUriThrowsExceptionTest.

/*
   * @testName: constructorIntUriThrowsExceptionTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:349;
   * 
   * @test_Strategy: Construct a new redirection exception.
   * java.lang.IllegalArgumentException - in case the status code is not a valid
   * HTTP status code or is not from Response.Status.Family.REDIRECTION status
   * code family.
   */
@Test
public void constructorIntUriThrowsExceptionTest() throws Fault {
    for (Status status : getStatusesOutsideFamily()) {
        try {
            RedirectionException e = new RedirectionException(status.getStatusCode(), LOCATION);
            fault("IllegalArgumentException has not been thrown for status", status, "; exception", e);
        } catch (IllegalArgumentException e) {
            logMsg("IllegalArgumentException has been thrown as expected for status", status);
        }
    }
}
Also used : Status(jakarta.ws.rs.core.Response.Status) RedirectionException(jakarta.ws.rs.RedirectionException) Test(org.junit.jupiter.api.Test)

Example 34 with Status

use of jakarta.ws.rs.core.Response.Status in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method constructorIntUriTest.

/*
   * @testName: constructorIntUriTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:349; JAXRS:JAVADOC:347; JAXRS:JAVADOC:12;
   * 
   * @test_Strategy: Construct a new redirection exception.
   * java.lang.IllegalArgumentException - in case the status code is not a valid
   * HTTP status code or is not from Response.Status.Family.REDIRECTION status
   * code family.
   * 
   * Get the redirection response location.
   * 
   * getResponse
   */
@Test
public void constructorIntUriTest() throws Fault {
    for (Status status : getStatusesFromFamily()) {
        RedirectionException e = new RedirectionException(status.getStatusCode(), LOCATION);
        assertResponse(e, status);
        assertLocation(e, LOCATION);
    }
}
Also used : Status(jakarta.ws.rs.core.Response.Status) RedirectionException(jakarta.ws.rs.RedirectionException) Test(org.junit.jupiter.api.Test)

Example 35 with Status

use of jakarta.ws.rs.core.Response.Status in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method constructorStringIntUriThrowsIAETest.

/*
   * @testName: constructorStringIntUriThrowsIAETest
   * 
   * @assertion_ids: JAXRS:JAVADOC:1096;
   * 
   * @test_Strategy: Construct a new redirection exception.
   * java.lang.IllegalArgumentException - in case the status code is not a valid
   * HTTP status code or is not from Response.Status.Family.REDIRECTION status
   * code family.
   */
@Test
public void constructorStringIntUriThrowsIAETest() throws Fault {
    for (Status status : getStatusesOutsideFamily()) {
        try {
            RedirectionException e = new RedirectionException(MESSAGE, status.getStatusCode(), LOCATION);
            fault("IllegalArgumentException has not been thrown for status", status, "; exception", e);
        } catch (IllegalArgumentException e) {
            logMsg("IllegalArgumentException has been thrown as expected for status", status);
        }
    }
}
Also used : Status(jakarta.ws.rs.core.Response.Status) RedirectionException(jakarta.ws.rs.RedirectionException) Test(org.junit.jupiter.api.Test)

Aggregations

Status (jakarta.ws.rs.core.Response.Status)68 Test (org.junit.jupiter.api.Test)58 Response (jakarta.ws.rs.core.Response)25 ClientErrorException (jakarta.ws.rs.ClientErrorException)12 ServerErrorException (jakarta.ws.rs.ServerErrorException)12 RedirectionException (jakarta.ws.rs.RedirectionException)10 Path (jakarta.ws.rs.Path)9 GET (jakarta.ws.rs.GET)6 WebApplicationException (jakarta.ws.rs.WebApplicationException)6 ReadableWritableEntity (ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity)4 BadRequestException (jakarta.ws.rs.BadRequestException)4 InternalServerErrorException (jakarta.ws.rs.InternalServerErrorException)4 POST (jakarta.ws.rs.POST)3 IOException (java.io.IOException)3 Consumes (jakarta.ws.rs.Consumes)2 ForbiddenException (jakarta.ws.rs.ForbiddenException)2 NotAcceptableException (jakarta.ws.rs.NotAcceptableException)2 StatusType (jakarta.ws.rs.core.Response.StatusType)2 AnyExceptionExceptionMapper (ee.jakarta.tck.ws.rs.ee.rs.ext.exceptionmapper.AnyExceptionExceptionMapper)1 SyncInvoker (jakarta.ws.rs.client.SyncInvoker)1