1 7 package org.hammurapi.inspectors.metrics.callertrace.tests; 8 9 10 11 import java.util.SortedMap ; 12 import java.util.TreeMap ; 13 14 import junit.framework.Test; 15 import junit.framework.TestCase; 16 import junit.framework.TestSuite; 17 18 import org.hammurapi.inspectors.metrics.callertrace.MethodWrapper; 19 import org.hammurapi.inspectors.metrics.callertrace.MethodWrapperDeclaration; 20 import org.hammurapi.inspectors.metrics.callertrace.TracedMethodLocComparator; 21 22 28 public class TracedMethodLocComparatorTest extends TestCase { 29 30 31 public static Test suite() { 32 return new TestSuite(TracedMethodLocComparatorTest.class); 33 } 34 35 36 public void testSorted1(){ 37 38 SortedMap keyMethodList = new TreeMap (new TracedMethodLocComparator()); 39 MethodWrapper m = new MethodWrapperDeclaration("", "MyClass"); 40 m.setLine(1); 41 keyMethodList.put(m,m); 42 m = new MethodWrapperDeclaration("", "MyClass"); 43 m.setLine(20); 44 keyMethodList.put(m,m); 45 m = new MethodWrapperDeclaration("", "MyClass"); 46 m.setLine(30); 47 keyMethodList.put(m,m); 48 m = (MethodWrapperDeclaration)keyMethodList.firstKey(); 49 50 assertTrue("keyMethodList.size() should be 3 but is " + keyMethodList.size(), keyMethodList.size() == 3); 51 52 m = (MethodWrapperDeclaration)keyMethodList.lastKey(); 53 assertTrue("m.getLine() should be 30 but is " + m.getLine(), m.getLine() == 30); 54 55 } 56 } 57 58 | Popular Tags |