-
Notifications
You must be signed in to change notification settings - Fork 394
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
[WICKET-7069] Refactor assertTrue(equals())
using assertEquals
#601
Conversation
Hello @Taher-Ghaleb please revert your commit labeled It breaks the build, because: If tests is defined as follows:
It doesn't mean it expects the |
wicket-core/src/test/java/org/apache/wicket/markup/MarkupParserTest.java
Outdated
Show resolved
Hide resolved
Thanks @solomax for your feedback. I must have misunderstood the actual objective of these cases. I will revert that commit shortly. In our research, we have actually encountered test cases where developers refactor exception handling operations using the |
This reverts commit d667baf.
AFAIK for ex. see here: https://www.baeldung.com/junit-5-migration#1-annotations |
Should I change the title and description of the pull request to reflect the eventual changes performed? |
wicket-core/src/test/java/org/apache/wicket/markup/MarkupParserTest.java
Outdated
Show resolved
Hide resolved
Yes, please :)) I can take care of both steps :) |
wicket-core/src/test/java/org/apache/wicket/markup/MarkupParserTest.java
Outdated
Show resolved
Hide resolved
assertTrue(equals())
using assertEquals
& throws Exception
using assertThrows
assertTrue(equals())
using assertEquals
assertTrue(equals())
using assertEquals
assertTrue(equals())
using assertEquals
) * Refactor assertTrue(equals()) using assertEquals * Refactor throws Exception using assertThrows * Revert "Refactor throws Exception using assertThrows" This reverts commit d667baf. * Fix assertEquals parameters as (expected, actual) * Fix test case failures by converting tokens into strings
Thanks for the contribution @Taher-Ghaleb ! |
I am working on research that investigates test smell refactoring in which we identify alternative implementations of test cases, study how commonly used these refactorings are, and assess how acceptable they are in practice.
The first smell is when inappropriate assertions are used, while there exist better alternatives. For example, in throws Exception using assertThrows, I refactored
assertTrue(img.getName().equals("img"));
usingassertEquals(img.getName(), "img");
.The second smell is when exception handling can alternatively be implemented using assertion rather than annotation. For example, in ApplicationSettingsTest.java, I used
assertThrows(Exception.class, () -> {...});
instead ofthrows Exception
.While there could be several cases like this, we aim in this pull request to get your feedback on these particular test smells and their refactorings. Thanks in advance for your input.