Skip to content

Commit

Permalink
Add a Default Exception Mapper test.
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteCat22 committed Mar 12, 2024
1 parent e5994e3 commit 5747691
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.extension.ExtendWith;

import jakarta.ws.rs.core.Response.Status;
import ee.jakarta.tck.ws.rs.common.JAXRSCommonClient;
import ee.jakarta.tck.ws.rs.lib.util.TestUtil;
import jakarta.ws.rs.core.Response.Status;

/*
* @class.setup_props: webServerHost;
Expand Down Expand Up @@ -296,4 +296,19 @@ public void throwableStatusCodeTest() throws Fault {
setProperty(STATUS_CODE, getStatusCode(Status.NO_CONTENT));
invoke();
}

/*
* @testName: defaultExceptionMapperTest
*
* @assertion_ids: JAXRS:JAVADOC:19;
*
* @test_Strategy: Client invokes GET on root resource at /resource; Verify
* that Throwable is mapped to HTTP 500.
*/
@Test
public void defaultExceptionMapperTest() throws Fault {
setProperty(REQUEST, buildRequest(GET, "DefaultExceptionMapperTest"));
setProperty(STATUS_CODE, getStatusCode(Status.INTERNAL_SERVER_ERROR));
invoke();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ public Response throwableStatusCodeTest() {
new Throwable(id("-throwableStatusCodeTest")), 204);
}

@GET
@Path("/DefaultExceptionMapperTest")
public Response defaultExceptionMapperTest() throws Throwable {
throw new Throwable(id("-defaultExceptionMapperTest"));
}

public static String id(String suffix) {
return new StringBuilder().append(TESTID).append(suffix).toString();
}
Expand Down

0 comments on commit 5747691

Please sign in to comment.