Debian Codegraph @

test/src/net/sf/antcontrib/logic/RelentlessTaskTest.java

raw symbols SCIP
1 /*
2 * Copyright (c) 2005 Ant-Contrib project. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package net.sf.antcontrib.logic;
17
18 import org.apache.tools.ant.BuildFileTest;
19
20 /**
21 * Testcase for <relentless>.
22 * @author Christopher Heiny
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 }