| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
package net.sf.antcontrib.logic; |
| 17 |
|
| 18 |
import org.apache.tools.ant.BuildFileTest; |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
public class RelentlessTaskTest extends BuildFileTest { |
| 25 |
|
| 26 |
public RelentlessTaskTest(String name) { |
| 27 |
super(name); |
| 28 |
} |
| 29 |
|
| 30 |
public void setUp() { |
| 31 |
configureProject("test/resources/logic/relentless.xml"); |
| 32 |
} |
| 33 |
|
| 34 |
public void tearDown() { |
| 35 |
executeTarget("teardown"); |
| 36 |
} |
| 37 |
|
| 38 |
public void testSimpleTasks() { |
| 39 |
simpleTest("simpleTasks"); |
| 40 |
} |
| 41 |
|
| 42 |
public void testFailTask() { |
| 43 |
expectSpecificBuildException("failTask", "2 failed tasks", |
| 44 |
"Relentless execution: 2 of 4 tasks failed."); |
| 45 |
} |
| 46 |
|
| 47 |
public void testNoTasks() { |
| 48 |
expectSpecificBuildException("noTasks", "missing task list", |
| 49 |
"No tasks specified for <relentless>."); |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
private void simpleTest(String target) { |
| 54 |
executeTarget(target); |
| 55 |
int last = -1; |
| 56 |
for (int i = 1; i < 4; i++) { |
| 57 |
int thisIdx = getLog().indexOf("Called with param: " + i); |
| 58 |
assertTrue(thisIdx > last); |
| 59 |
last = thisIdx; |
| 60 |
} |
| 61 |
} |
| 62 |
} |