1 17 18 package org.apache.tools.ant.taskdefs.optional.jdepend; 19 20 import java.io.File ; 21 import java.io.FileReader ; 22 import java.io.IOException ; 23 import java.util.Date ; 24 import java.util.Vector ; 25 import java.util.Enumeration ; 26 import java.util.Hashtable ; 27 import org.apache.tools.ant.BuildFileTest; 28 import org.apache.tools.ant.Project; 29 import org.apache.tools.ant.types.FileSet; 30 import org.apache.tools.ant.DirectoryScanner; 31 32 36 public 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 51 public void testSimple() { 52 expectOutputContaining( 53 "simple", "Package: org.apache.tools.ant.util.facade"); 54 } 55 56 59 public void testXml() { 60 expectOutputContaining( 61 "xml", "<DependsUpon>"); 62 } 63 64 68 public void testFork() { 69 expectLogContaining( 70 "fork", "Package: org.apache.tools.ant.util.facade"); 71 } 72 73 76 public void testForkXml() { 77 expectLogContaining( 78 "fork-xml", "<DependsUpon>"); 79 } 80 81 84 public void testTimeout() { 85 expectLogContaining( 86 "fork-timeout", "JDepend FAILED - Timed out"); 87 } 88 89 90 93 public void testTimeoutNot() { 94 expectLogContaining( 95 "fork-timeout-not", "Package: org.apache.tools.ant.util.facade"); 96 } 97 98 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 112 protected void expectOutputContaining(String target, String substring) { 113 executeTarget(target); 114 assertOutputContaining(substring); 115 } 116 117 } 118 | Popular Tags |