-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to test caught exceptions #591
Comments
ArchUnit currently does not recognize the bytecode signature of
|
This might be a nice addition, but I would propose a type |
Signed-off-by: Krzysztof Sierszeń <[email protected]>
PR attached. (Sorry if sth is not quite done the 'ArchUnit way', but this is my first PR here) |
Signed-off-by: Krzysztof Sierszeń <[email protected]>
Signed-off-by: Krzysztof Sierszeń <[email protected]>
This will add `TryCatchBlocks` to the ArchUnit core and introduce `JavaCodeUnit.getTryCatchBlocks()` to examine try-catch blocks that have been parsed from the bytecode of a method or constructor. We also add an extension `JavaAccess.getContainingTryBlocks()` to make it easy to verify that certain accesses in code are wrapped into certain try-catch blocks (e.g. "whenever method x is called there should be a try-catch block to handle exception case y"). Resolves: #591 Signed-off-by: Krzysztof Sierszeń <[email protected]>
I would like to be able to assert that some method calls are wrapped in a try/catch block catching certain type of exceptions.
Typical use case would be to make sure that runtime
WebApplicationExceptions
are caught when calling a remote resource using JAX-RS.I'd be happy to try to contribute with a PR, if it could eventually be merged.
The text was updated successfully, but these errors were encountered: