01: /*
02: * Author: Chris Seguin
03: *
04: * This software has been developed under the copyleft
05: * rules of the GNU General Public License. Please
06: * consult the GNU General Public License for more
07: * details about use and distribution of this software.
08: */
09: package org.acm.seguin.uml.refactor;
10:
11: import java.io.File;
12: import java.util.Iterator;
13: import org.acm.seguin.summary.SummaryTraversal;
14: import org.acm.seguin.io.FileCopy;
15: import org.acm.seguin.summary.TypeSummary;
16: import org.acm.seguin.summary.PackageSummary;
17: import org.acm.seguin.summary.query.GetTypeSummary;
18: import org.acm.seguin.junit.DirSourceTestCase;
19:
20: /**
21: * Test cases for the TypeCheckbox object
22: *
23: *@author Chris Seguin
24: */
25: public class TestTypeCheckbox extends DirSourceTestCase {
26: /**
27: * Constructor for the TestTypeCheckbox object
28: *
29: *@param name Description of Parameter
30: */
31: public TestTypeCheckbox(String name) {
32: super (name);
33: }
34:
35: /**
36: * A unit test for JUnit
37: */
38: public void test1() {
39: PackageSummary packageSummary = PackageSummary
40: .getPackageSummary("imp.inh");
41: TypeSummary baseClass = GetTypeSummary.query(packageSummary,
42: "BaseClass");
43:
44: Iterator iter = baseClass.getTypes();
45: if (iter == null) {
46: fail("Should have a class called SampleClass in it");
47: }
48:
49: TypeSummary sampleClass = (TypeSummary) iter.next();
50:
51: TypeCheckbox tcb = new TypeCheckbox(sampleClass);
52: assertEquals("Values not the same!",
53: "imp.inh.BaseClass.SampleClass", tcb.getFullName());
54: }
55:
56: /**
57: * The JUnit setup method
58: */
59: protected void setUp() {
60: File cleanDir = new File(clean);
61: File destDir = new File(root + "\\imp\\inh");
62:
63: (new FileCopy(new File(cleanDir, "imp_inh_BaseClass.java"),
64: new File(destDir, "BaseClass.java"), false)).run();
65:
66: (new SummaryTraversal(root)).run();
67: }
68:
69: /**
70: * The teardown method for JUnit
71: */
72: protected void tearDown() {
73: File destDir = new File(root + "\\imp\\inh");
74: (new File(destDir, "BaseClass.java")).delete();
75: }
76: }
|