| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
package net.sf.antcontrib.property; |
| 17 |
|
| 18 |
import org.apache.tools.ant.BuildFileTest; |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
public class PathToFileSetTest extends BuildFileTest { |
| 24 |
|
| 25 |
public PathToFileSetTest(String name) { |
| 26 |
super(name); |
| 27 |
} |
| 28 |
|
| 29 |
public void setUp() { |
| 30 |
configureProject("test/resources/property/pathtofileset.xml"); |
| 31 |
} |
| 32 |
|
| 33 |
public void tearDown() { |
| 34 |
executeTarget("cleanup"); |
| 35 |
} |
| 36 |
|
| 37 |
public void testSimple() { |
| 38 |
executeTarget("simple"); |
| 39 |
assertPropertyContains("simple.0.property", "0.java"); |
| 40 |
assertPropertyContains("simple.0.property", "1.java"); |
| 41 |
assertPropertyNotContains("simple.0.property", "2.java"); |
| 42 |
assertPropertyNotContains("simple.0.property", "3.java"); |
| 43 |
assertPropertyNotContains("simple.1.property", "0.java"); |
| 44 |
assertPropertyNotContains("simple.1.property", "1.java"); |
| 45 |
assertPropertyContains("simple.1.property", "2.java"); |
| 46 |
assertPropertyContains("simple.1.property", "3.java"); |
| 47 |
} |
| 48 |
|
| 49 |
public void testSimpleException() { |
| 50 |
expectBuildExceptionContaining("simple-exception", "expect not relative to", |
| 51 |
"is not relative to"); |
| 52 |
} |
| 53 |
|
| 54 |
private void assertPropertyContains(String property, String expected) { |
| 55 |
String result = getProject().getProperty(property); |
| 56 |
assertTrue("property " + property + " contains " + expected, |
| 57 |
result.indexOf(expected) != -1); |
| 58 |
} |
| 59 |
|
| 60 |
private void assertPropertyNotContains(String property, String expected) { |
| 61 |
String result = getProject().getProperty(property); |
| 62 |
assertTrue("property " + property + " contains " + expected, |
| 63 |
result.indexOf(expected) == -1); |
| 64 |
} |
| 65 |
|
| 66 |
} |