source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/src/testcases/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 3.1 KB
Line 
1/*
2 * Copyright 2003-2004 The Apache Software Foundation
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 */
17
18package org.apache.tools.ant.taskdefs.optional.jdepend;
19
20import java.io.File;
21import java.io.FileReader;
22import java.io.IOException;
23import java.util.Date;
24import java.util.Vector;
25import java.util.Enumeration;
26import java.util.Hashtable;
27import org.apache.tools.ant.BuildFileTest;
28import org.apache.tools.ant.Project;
29import org.apache.tools.ant.types.FileSet;
30import org.apache.tools.ant.DirectoryScanner;
31
32/**
33 * Testcase for the JDepend optional task.
34 *
35 */
36public class JDependTest extends BuildFileTest {
37 public static final String RESULT_FILESET = "result";
38
39 public JDependTest(String name) {
40 super(name);
41 }
42
43 public void setUp() {
44 configureProject(
45 "src/etc/testcases/taskdefs/optional/jdepend/jdepend.xml");
46 }
47
48 /**
49 * Test simple
50 */
51 public void testSimple() {
52 expectOutputContaining(
53 "simple", "Package: org.apache.tools.ant.util.facade");
54 }
55
56 /**
57 * Test xml
58 */
59 public void testXml() {
60 expectOutputContaining(
61 "xml", "<DependsUpon>");
62 }
63
64 /**
65 * Test fork
66 * - forked output goes to log
67 */
68 public void testFork() {
69 expectLogContaining(
70 "fork", "Package: org.apache.tools.ant.util.facade");
71 }
72
73 /**
74 * Test fork xml
75 */
76 public void testForkXml() {
77 expectLogContaining(
78 "fork-xml", "<DependsUpon>");
79 }
80
81 /**
82 * Test timeout
83 */
84 public void testTimeout() {
85 expectLogContaining(
86 "fork-timeout", "JDepend FAILED - Timed out");
87 }
88
89
90 /**
91 * Test timeout without timing out
92 */
93 public void testTimeoutNot() {
94 expectLogContaining(
95 "fork-timeout-not", "Package: org.apache.tools.ant.util.facade");
96 }
97
98 /**
99 * Assert that the given substring is in the output messages
100 */
101
102 protected void assertOutputContaining(String substring) {
103 String realOutput = getOutput();
104 assertTrue("expecting output to contain \"" + substring + "\" output was \""
105 + realOutput + "\"",
106 realOutput.indexOf(substring) >= 0);
107 }
108
109 /**
110 * Assert that the given message has been outputted
111 */
112 protected void expectOutputContaining(String target, String substring) {
113 executeTarget(target);
114 assertOutputContaining(substring);
115 }
116
117}
Note: See TracBrowser for help on using the repository browser.