Grouping assertions
Created by: eas5
Problem: A test method with many individual assertions stops being executed on the first failed assertion, which prevents the execution of the remaining ones.
Solution: By using the JUnit5 grouped assertions feature, all assertions are executed and all failures will be reported together. In this refactoring, no original assertion was changed.
Result: Before:
assertFalse(pathMatcher.match("/admin/?*/**", "/admin"));
assertFalse(pathMatcher.match("/admin/?*/**", "/admin/"));
assertTrue(pathMatcher.match("/admin/?*/**", "/admin/index.html"));
assertTrue(pathMatcher.match("/admin/?*/**", "/admin/index.html/more"));
After:
assertAll(
() -> assertFalse(pathMatcher.match("/admin/?*/**", "/admin")),
() -> assertFalse(pathMatcher.match("/admin/?*/**", "/admin/")),
() -> assertTrue(pathMatcher.match("/admin/?*/**", "/admin/index.html")),
() -> assertTrue(pathMatcher.match("/admin/?*/**", "/admin/index.html/more"))
);