01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18:
19: package org.apache.tools.ant.taskdefs.optional.jdepend;
20:
21: import org.apache.tools.ant.BuildFileTest;
22:
23: /**
24: * Testcase for the JDepend optional task.
25: *
26: */
27: public class JDependTest extends BuildFileTest {
28: public static final String RESULT_FILESET = "result";
29:
30: public JDependTest(String name) {
31: super (name);
32: }
33:
34: public void setUp() {
35: configureProject("src/etc/testcases/taskdefs/optional/jdepend/jdepend.xml");
36: }
37:
38: /**
39: * Test simple
40: */
41: public void testSimple() {
42: expectOutputContaining("simple",
43: "Package: org.apache.tools.ant.util.facade");
44: }
45:
46: /**
47: * Test xml
48: */
49: public void testXml() {
50: expectOutputContaining("xml", "<DependsUpon>");
51: }
52:
53: /**
54: * Test fork
55: * - forked output goes to log
56: */
57: public void testFork() {
58: expectLogContaining("fork",
59: "Package: org.apache.tools.ant.util.facade");
60: }
61:
62: /**
63: * Test fork xml
64: */
65: public void testForkXml() {
66: expectLogContaining("fork-xml", "<DependsUpon>");
67: }
68:
69: /**
70: * Test timeout
71: */
72: public void testTimeout() {
73: expectLogContaining("fork-timeout",
74: "JDepend FAILED - Timed out");
75: }
76:
77: /**
78: * Test timeout without timing out
79: */
80: public void testTimeoutNot() {
81: expectLogContaining("fork-timeout-not",
82: "Package: org.apache.tools.ant.util.facade");
83: }
84:
85: /**
86: * Assert that the given message has been outputted
87: */
88: protected void expectOutputContaining(String target,
89: String substring) {
90: executeTarget(target);
91: assertOutputContaining(substring);
92: }
93:
94: }
|