-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a TCK test to verify that the default ExceptionMapper can be over…
…ridden. Signed-off-by: Adam Anderson <[email protected]>
- Loading branch information
1 parent
e5994e3
commit c8aa779
Showing
3 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...jakarta/tck/ws/rs/ee/resource/webappexception/mapper/OverridenDefaultExceptionMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0, which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception, which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
*/ | ||
package ee.jakarta.tck.ws.rs.ee.resource.webappexception.mapper; | ||
|
||
import jakarta.ws.rs.core.Response; | ||
import jakarta.ws.rs.ext.ExceptionMapper; | ||
|
||
public class OverridenDefaultExceptionMapper implements ExceptionMapper<Throwable> { | ||
|
||
/* | ||
* 4.4. Exception Mapping Providers states: | ||
* "A JAX-RS implementation MUST include a default exception mapping provider | ||
* that implements ExceptionMapper<Throwable> and which SHOULD set the | ||
* response status to 500." | ||
* | ||
* This class should override the default ExceptionMapper and set the | ||
* response status to 512 to verify that the default ExceptionMapper | ||
* was overriden. | ||
*/ | ||
@Override | ||
public Response toResponse(Throwable throwable) { | ||
return Response.status(512).build(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters