Browse Source

Junit → JUnit

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1453094 13f79535-47bb-0310-9956-ffa450edef68
master
Jesse N. Glick 12 years ago
parent
commit
4e101e3c49
9 changed files with 20 additions and 20 deletions
  1. +2
    -2
      src/etc/testcases/taskdefs/optional/junit.xml
  2. +2
    -2
      src/etc/testcases/taskdefs/optional/junitreport.xml
  3. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/CustomJUnit4TestAdapterCache.java
  4. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/junit/IgnoredTestListener.java
  5. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  6. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java
  7. +3
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
  8. +1
    -1
      src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java
  9. +1
    -1
      src/tests/junit/org/example/junit/JUnit4Skippable.java

+ 2
- 2
src/etc/testcases/taskdefs/optional/junit.xml View File

@@ -276,7 +276,7 @@
</junit>
</target>

<!-- Junit4 Ignore and Assume for skipping tests -->
<!-- JUnit4 Ignore and Assume for skipping tests -->
<target name="testSkippableTests">
<mkdir dir="out"/>
<junit fork="true">
@@ -285,7 +285,7 @@
<classpath refid="test"/>
<batchtest todir="out">
<fileset dir="../../../../tests/junit">
<include name="org/example/junit/Junit4Skippable.java"/>
<include name="org/example/junit/JUnit4Skippable.java"/>
<!-- tests remove out-dir on tearDown -->
</fileset>
</batchtest>


+ 2
- 2
src/etc/testcases/taskdefs/optional/junitreport.xml View File

@@ -23,7 +23,7 @@

<!-- reports1 take care of transformation of 2 test result files and
produce reports according to the default format (frames)
needed for testNoFileJunitNoFrames -->
needed for testNoFileJUnitNoFrames -->
<target name="reports1">
<mkdir dir="${outputdir}"/>
<mkdir dir="${outputdir}/html"/>
@@ -185,4 +185,4 @@
</target>

</project>

+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/junit/CustomJUnit4TestAdapterCache.java View File

@@ -27,7 +27,7 @@ import org.junit.runner.notification.RunListener;
import org.junit.runner.notification.RunNotifier;

/**
* Provides a custom implementation of the notifier for a Junit4TestAdapter
* Provides a custom implementation of the notifier for a JUnit4TestAdapter
* so that skipped and ignored tests can be reported to the existing
* <tt>TestListener</tt>s.
*


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/optional/junit/IgnoredTestListener.java View File

@@ -24,15 +24,15 @@ import org.junit.runner.notification.Failure;

/**
* Provides the functionality for TestListeners to be able to be notified of
* the necessary Junit4 events for test being ignored (@Ignore annotation)
* or skipped (Assume failures). Tests written in Junit4 will report against
* the necessary JUnit4 events for test being ignored (@Ignore annotation)
* or skipped (Assume failures). Tests written in JUnit4 will report against
* the methods in this interface alongside the methods in the existing TestListener
*/
public interface IgnoredTestListener extends TestListener {

/**
* Reports when a test has been marked with the @Ignore annotation. The parameter
* should normally be typed to Junit's {@link junit.framework.JUnit4TestCaseFacade}
* should normally be typed to JUnit's {@link junit.framework.JUnit4TestCaseFacade}
* so implementing classes should be able to get the details of the ignore by casting
* the argument and retrieving the descriptor from the test.
* @param test


+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -164,7 +164,7 @@ public class JUnitTask extends Task {
private Permissions perm = null;
private ForkMode forkMode = new ForkMode("perTest");

private boolean splitJunit = false;
private boolean splitJUnit = false;
private boolean enableTestListenerEvents = false;
private JUnitTaskMirror delegate;
private ClassLoader mirrorLoader;
@@ -714,7 +714,7 @@ public class JUnitTask extends Task {
*/
public void init() {
antRuntimeClasses = new Path(getProject());
splitJunit = !addClasspathResource("/junit/framework/TestCase.class");
splitJUnit = !addClasspathResource("/junit/framework/TestCase.class");
addClasspathEntry("/org/apache/tools/ant/launch/AntMain.class");
addClasspathEntry("/org/apache/tools/ant/Task.class");
addClasspathEntry("/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.class");
@@ -751,7 +751,7 @@ public class JUnitTask extends Task {
*/
protected void setupJUnitDelegate() {
final ClassLoader myLoader = JUnitTask.class.getClassLoader();
if (splitJunit) {
if (splitJUnit) {
final Path path = new Path(getProject());
path.add(antRuntimeClasses);
Path extra = getCommandline().getClasspath();
@@ -825,7 +825,7 @@ public class JUnitTask extends Task {

/**
* Run the tests.
* @param arg one JunitTest
* @param arg one JUnitTest
* @throws BuildException in case of test failures or errors
*/
protected void execute(JUnitTest arg) throws BuildException {
@@ -1379,7 +1379,7 @@ public class JUnitTask extends Task {
try {
log("Using System properties " + System.getProperties(),
Project.MSG_VERBOSE);
if (splitJunit) {
if (splitJUnit) {
classLoader = (AntClassLoader) delegate.getClass().getClassLoader();
} else {
createClassLoader();
@@ -1636,7 +1636,7 @@ public class JUnitTask extends Task {
try {
log("Using System properties " + System.getProperties(),
Project.MSG_VERBOSE);
if (splitJunit) {
if (splitJUnit) {
classLoader = (AntClassLoader) delegate.getClass().getClassLoader();
} else {
createClassLoader();


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java View File

@@ -112,7 +112,7 @@ public class JUnitVersionHelper {

/**
* Tries to find the name of the class which a test represents
* across JUnit 3 and 4. For Junit4 it parses the toString() value of the
* across JUnit 3 and 4. For JUnit4 it parses the toString() value of the
* test, and extracts it from there.
* @since Ant 1.7.1 (it was private until then)
* @param test test case to look at


+ 3
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java View File

@@ -304,12 +304,12 @@ public class JUnitTaskTest extends BuildFileTest {
assertEquals(search, line);
}

public void testJunit4Skip() throws Exception {
public void testJUnit4Skip() throws Exception {
executeTarget("testSkippableTests");

DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(getProject().getResource("out/TEST-org.example.junit.Junit4Skippable.xml").getInputStream());
Document doc = dBuilder.parse(getProject().getResource("out/TEST-org.example.junit.JUnit4Skippable.xml").getInputStream());

assertEquals("Incorrect number of nodes created", 8, doc.getElementsByTagName("testcase").getLength());

@@ -333,4 +333,4 @@ public class JUnitTaskTest extends BuildFileTest {
executeTarget("testTestMethods");
}

}
}

+ 1
- 1
src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java View File

@@ -94,7 +94,7 @@ public class AssertionsTest extends BuildFileTest {
}


public void testJunit() {
public void testJUnit() {
executeTarget("test-junit");
}
}


src/tests/junit/org/example/junit/Junit4Skippable.java → src/tests/junit/org/example/junit/JUnit4Skippable.java View File

@@ -25,7 +25,7 @@ import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

public class Junit4Skippable {
public class JUnit4Skippable {

@Test
public void passingTest() {

Loading…
Cancel
Save