JUnit 4.13.2 Source Code Files

JUnit Source Code Files are provided in the source package file, junit-4.13.2-sources.jar.

You can browse JUnit Source Code files below:

✍: FYIcenter.com

org/junit/rules/TestName.java

package org.junit.rules;

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());
 *     }
 * }
 * </pre>
 *
 * @since 4.7
 */
public class TestName extends TestWatcher {
    private volatile String name;

    @Override
    protected void starting(Description d) {
        name = d.getMethodName();
    }

    /**
     * @return the name of the currently-running test method
     */
    public String getMethodName() {
        return name;
    }
}

org/junit/rules/TestName.java

 

Or download all of them as a single archive file:

File name: junit-4.13.2-sources.jar
File size: 234540 bytes
Release date: 2021-02-13
Download 

 

Download and Install junit-4.12.jar

Download and Install junit-4.13.2.jar

Download and Install JUnit (Java Unit) Testing

⇑⇑ FAQ for JUnit (Java Unit) Testing

2016-03-28, 11603👍, 0💬