Browse Source

Fixed a broken test

master
Gintas Grigelionis 6 years ago
parent
commit
fad0683b49
2 changed files with 15 additions and 7 deletions
  1. +4
    -5
      src/etc/testcases/core/dispatch/dispatch.xml
  2. +11
    -2
      src/tests/junit/org/apache/tools/ant/DispatchTaskTest.java

+ 4
- 5
src/etc/testcases/core/dispatch/dispatch.xml View File

@@ -19,14 +19,13 @@
<project name="dispatch-test" default="disp">

<path id="testclasses">
<pathelement location="../../../../build/testcases" />
<pathelement path="${java.class.path}" />
<pathelement location="${build.tests.value}"/>
<pathelement path="${java.class.path}"/>
</path>

<target name="disp">
<taskdef name="disptask"
classname="org.apache.tools.ant.taskdefs.PickOneTask">
<classpath refid="testclasses" />
<taskdef name="disptask" classname="org.apache.tools.ant.PickOneTask">
<classpath refid="testclasses"/>
</taskdef>
<disptask action="list"/>
</target>


+ 11
- 2
src/tests/junit/org/apache/tools/ant/DispatchTaskTest.java View File

@@ -21,19 +21,28 @@ package org.apache.tools.ant;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import static org.junit.Assert.assertNotNull;

public class DispatchTaskTest {

@Rule
public BuildFileRule buildRule = new BuildFileRule();

@Rule
public ExpectedException thrown = ExpectedException.none();

@Before
public void setUp() {
assertNotNull("build.tests.value not set", System.getProperty("build.tests.value"));
buildRule.configureProject("src/etc/testcases/core/dispatch/dispatch.xml");
}

@Test(expected = BuildException.class)
@Test
public void testDisp() {
buildRule.executeTarget("disp");
thrown.expect(BuildException.class);
thrown.expectMessage("list");
buildRule.executeTarget("disp");
}
}

Loading…
Cancel
Save