Details
-
Improvement
-
Resolution: Won't Fix
-
Minor
-
None
-
None
-
-
Yes
-
Empty show more show less
Description
Here's a patch that should allow this (pending classloader issues - to be validated with tests running in forked mode)
The method - before and after patch - can appear a little unnecessary. In a regular junit3 test, one can simply do getName() to get the test method name. In Junit4, one can add the following to her test class
@Rule
public final TestName testName = new TestName();
and consequently do testName.getMethodName() when necessary.
However the util method allows to know the current test method in "external" classes (i.e where we'd have additional assertFoo() type of methods).
Additionally, the patch provides a desc() method, which can be used to provide a default assertion description (assertTrue(desc(), some.boolean())), thus avoiding unnecessary typing/test description duplication.
Checklists
Acceptance criteria