|
|
@@ -21,43 +21,45 @@ package org.apache.tools.ant.types; |
|
|
|
import org.apache.tools.ant.BuildFileRule; |
|
|
|
import org.junit.Rule; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.runner.RunWith; |
|
|
|
import org.junit.runners.Parameterized; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Collection; |
|
|
|
|
|
|
|
import static org.junit.Assert.assertEquals; |
|
|
|
|
|
|
|
/** |
|
|
|
* FilterSet testing |
|
|
|
* |
|
|
|
* Description tests |
|
|
|
*/ |
|
|
|
@RunWith(Parameterized.class) |
|
|
|
public class DescriptionTest { |
|
|
|
@Parameterized.Parameters(name = "{1}") |
|
|
|
public static Collection<Object[]> targets() { |
|
|
|
return Arrays.asList(new Object[][]{ |
|
|
|
{"description1", "Single", "Test Project Description"}, |
|
|
|
{"description2", "Multi line", "Multi Line\nProject Description"}, |
|
|
|
{"description3", "Multi instance", "Multi Instance Project Description"}, |
|
|
|
{"description4", "Multi instance nested", "Multi Instance Nested Project Description"} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@Rule |
|
|
|
public BuildFileRule buildRule = new BuildFileRule(); |
|
|
|
@Parameterized.Parameter |
|
|
|
public String fileName; |
|
|
|
|
|
|
|
@Test |
|
|
|
public void test1() { |
|
|
|
buildRule.configureProject("src/etc/testcases/types/description1.xml"); |
|
|
|
assertEquals("Single description failed", "Test Project Description", |
|
|
|
buildRule.getProject().getDescription()); |
|
|
|
} |
|
|
|
@Parameterized.Parameter(1) |
|
|
|
public String description; |
|
|
|
|
|
|
|
@Test |
|
|
|
public void test2() { |
|
|
|
buildRule.configureProject("src/etc/testcases/types/description2.xml"); |
|
|
|
assertEquals("Multi line description failed", "Multi Line\nProject Description", |
|
|
|
buildRule.getProject().getDescription()); |
|
|
|
} |
|
|
|
@Parameterized.Parameter(2) |
|
|
|
public String outcome; |
|
|
|
|
|
|
|
@Test |
|
|
|
public void test3() { |
|
|
|
buildRule.configureProject("src/etc/testcases/types/description3.xml"); |
|
|
|
assertEquals("Multi instance description failed", "Multi Instance Project Description", |
|
|
|
buildRule.getProject().getDescription()); |
|
|
|
} |
|
|
|
@Rule |
|
|
|
public BuildFileRule buildRule = new BuildFileRule(); |
|
|
|
|
|
|
|
@Test |
|
|
|
public void test4() { |
|
|
|
buildRule.configureProject("src/etc/testcases/types/description4.xml"); |
|
|
|
assertEquals("Multi instance nested description failed", "Multi Instance Nested Project Description", |
|
|
|
public void test() { |
|
|
|
buildRule.configureProject("src/etc/testcases/types/" + fileName + ".xml"); |
|
|
|
assertEquals(description + " description failed", outcome, |
|
|
|
buildRule.getProject().getDescription()); |
|
|
|
} |
|
|
|
} |