1 package csdl.jblanket.methodset; 2 3 import java.util.ArrayList ; 4 import java.util.List ; 5 6 import java.io.File ; 7 8 import junit.framework.TestCase; 9 import junit.framework.TestSuite; 10 import junit.textui.TestRunner; 11 12 18 public class TestMethodSetManager extends TestCase { 19 20 21 private final String xmlFile1 = "xmlFile1.xml"; 22 23 24 private MethodSet methodSet1; 25 26 private MethodSet methodSet2; 27 28 29 private MethodInfo methodInfo1; 30 31 private MethodInfo methodInfo2; 32 33 34 private final String class1 = "java.lang.String"; 35 36 private final String class2 = "java.lang.Boolean"; 37 38 private final String class3 = "foo.bar.Baz"; 39 40 private final String class4 = "foo.bar.Foo"; 41 42 43 private final String method1 = "getQux"; 44 45 private final String method2 = "setQux"; 46 47 48 private final String slash = File.separator; 49 50 55 public TestMethodSetManager(String name) { 56 super(name); 57 } 58 59 62 public void setUp() { 63 List params = new ArrayList (); 65 params.add(class1); 66 params.add(class2); 67 methodInfo1 = new MethodInfo(class3, method1, params); 68 69 methodInfo2 = new MethodInfo(class4, method2, new ArrayList ()); 70 71 methodSet1 = new MethodSet(); 73 methodSet2 = new MethodSet(); 74 } 75 76 81 public void testMethodSetManager() throws Exception { 82 83 MethodSetManager manager = MethodSetManager.getInstance(); 85 methodSet1 = manager.getMethodSet(xmlFile1); 86 87 methodSet1.add(methodInfo1); 89 methodSet1.add(methodInfo2); 90 91 methodSet2 = manager.getMethodSet(xmlFile1); 93 assertTrue("checking that only one instance per file name", methodSet1.equals(methodSet2)); 94 } 95 96 101 public static void main(String [] args) { 102 System.out.println("JUnit testing MethodSetManager."); 103 TestRunner.run(new TestSuite(TestMethodSet.class)); 105 } 106 } 107 | Popular Tags |