Skip to content

POOL-415 Add an option to JdkProxySource allowing to unwrap UndeclaredThrowableException #261

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

reda-alaoui
Copy link
Member

@reda-alaoui reda-alaoui commented Dec 6, 2023

@reda-alaoui
Copy link
Member Author

Up :)

Copy link
Member

@garydgregory garydgregory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @reda-alaoui

Thank you for your ping. Please see my comments.

ObjectPool<TestObject, RuntimeException> pool = createProxiedObjectPool(true, new MyException());

TestObject object = pool.borrowObject();
try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @reda-alaoui

Please use assertThrows() where you can.

caughtException = e;
}

if (caughtException instanceof UndeclaredThrowableException || caughtException instanceof InvocationTargetException) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to refactor the test to make the expected exception unique. This will make what a subclass expects explicit, making each test class easier to understand. You can then use assertThrows() to make the test clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants