01: package csdl.jblanket.util;
02:
03: import junit.framework.TestCase;
04: import junit.framework.TestSuite;
05: import junit.textui.TestRunner;
06:
07: /**
08: * Tests operations in the DefaultFileName class.
09: * <p>
10: * If using Ant to execute this test class a 'jblanket.testdir' system property needs to be set in
11: * the build.xml file. If running test class from command line, must provide '-Djblanket.testdir'
12: * to set the system property. This value is used by both the testJar and testUnjar methods.
13: *
14: * @author Joy M. Agustin
15: * @version $Id: TestDefaultFileName.java,v 1.1 2004/11/07 00:32:27 timshadel Exp $
16: */
17: public class TestDefaultFileName extends TestCase {
18:
19: /**
20: * Required for JUnit.
21: *
22: * @param name Test case name.
23: */
24: public TestDefaultFileName(String name) {
25: super (name);
26: }
27:
28: /**
29: * Tests the getDefaultFileName method.
30: */
31: public void testGetDefaultFileName() {
32:
33: assertEquals("checking default file for totalFile",
34: "totalMethods.xml", DefaultFileName
35: .getDefaultFileName("totalFile"));
36:
37: assertEquals("checking default file for untestableFile",
38: "untestableMethods.xml", DefaultFileName
39: .getDefaultFileName("untestableFile"));
40:
41: assertEquals("checking default file for excludedFile",
42: "excludedMethods.xml", DefaultFileName
43: .getDefaultFileName("excludedFile"));
44:
45: assertEquals("checking default file for oneLineFile",
46: "oneLineMethods.xml", DefaultFileName
47: .getDefaultFileName("oneLineFile"));
48:
49: assertEquals("checking default file for constructorFile",
50: "constructorMethods.xml", DefaultFileName
51: .getDefaultFileName("constructorFile"));
52:
53: assertEquals(
54: "checking default file for excludedIndividualFile",
55: "excludedIndividualMethods.xml", DefaultFileName
56: .getDefaultFileName("excludedIndividualFile"));
57:
58: assertEquals("checking default file for total.testFile",
59: "total.testedMethods.xml", DefaultFileName
60: .getDefaultFileName("total.testedFile"));
61:
62: assertEquals("checking default file for total.diffFile",
63: "total.untestedMethods.xml", DefaultFileName
64: .getDefaultFileName("total.untestedFile"));
65:
66: assertEquals("checking default file for testFile",
67: "testedMethods.xml", DefaultFileName
68: .getDefaultFileName("testedFile"));
69:
70: assertEquals("checking default file for diffFile",
71: "untestedMethods.xml", DefaultFileName
72: .getDefaultFileName("untestedFile"));
73: }
74:
75: /**
76: * Provide stand-alone execution of this test case during initial development.
77: *
78: * @param args The command line arguments
79: */
80: public static void main(String[] args) {
81:
82: System.out.println("JUnit testing DefaultFileName.");
83: //Runs all no-arg methods starting with "test".
84: TestRunner.run(new TestSuite(TestDefaultFileName.class));
85: }
86:
87: }
|