aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/junit/rules/TestName.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/junit/rules/TestName.java')
-rw-r--r--src/main/java/org/junit/rules/TestName.java50
1 files changed, 26 insertions, 24 deletions
diff --git a/src/main/java/org/junit/rules/TestName.java b/src/main/java/org/junit/rules/TestName.java
index c4ab9ce..bf72602 100644
--- a/src/main/java/org/junit/rules/TestName.java
+++ b/src/main/java/org/junit/rules/TestName.java
@@ -4,36 +4,38 @@ import org.junit.runner.Description;
/**
* The TestName Rule makes the current test name available inside test methods:
- *
+ *
* <pre>
* public class TestNameTest {
- * &#064;Rule
- * public TestName name= new TestName();
- *
- * &#064;Test
- * public void testA() {
- * assertEquals(&quot;testA&quot;, name.getMethodName());
- * }
- *
- * &#064;Test
- * public void testB() {
- * assertEquals(&quot;testB&quot;, name.getMethodName());
- * }
+ * &#064;Rule
+ * public TestName name= new TestName();
+ *
+ * &#064;Test
+ * public void testA() {
+ * assertEquals(&quot;testA&quot;, name.getMethodName());
+ * }
+ *
+ * &#064;Test
+ * public void testB() {
+ * assertEquals(&quot;testB&quot;, name.getMethodName());
+ * }
* }
* </pre>
+ *
+ * @since 4.7
*/
public class TestName extends TestWatcher {
- private String fName;
+ private String name;
- @Override
- protected void starting(Description d) {
- fName= d.getMethodName();
- }
+ @Override
+ protected void starting(Description d) {
+ name = d.getMethodName();
+ }
- /**
- * @return the name of the currently-running test method
- */
- public String getMethodName() {
- return fName;
- }
+ /**
+ * @return the name of the currently-running test method
+ */
+ public String getMethodName() {
+ return name;
+ }
}