-
Notifications
You must be signed in to change notification settings - Fork 88
Closed
Labels
recipeRecipe requestRecipe request
Description
What problem are you trying to solve?
Test code readability.
In a test case:
assertTrue(true)
is a no-opassertTrue(false)
can be replaced withfail()
Similar for assertFalse
, etc. The same logic could probably be done in several variants for various test frameworks.
Describe the situation before applying the recipe
@Test
void testExceptionThrown() {
try {
someOperationWith("Invalid argument");
fail("Expected exception was not thrown");
} catch (IllegalArgumentException e) {
assertTrue(true);
}
}
Describe the situation after applying the recipe
@Test
void testExceptionThrown() {
try {
someOperationWith("Invalid argument");
fail("Expected exception was not thrown");
} catch (IllegalArgumentException e) {
}
}
Any additional context
I've stumbled upon this pattern when providing OSS examples for
Metadata
Metadata
Assignees
Labels
recipeRecipe requestRecipe request
Type
Projects
Status
Done