1 package com.kirkk.analyzer.framework.bcelbundle.test; 2 3 import junit.framework.*; 4 import java.io.*; 5 import com.kirkk.analyzer.framework.bcelbundle.*; 6 import com.kirkk.analyzer.framework.*; 7 import com.kirkk.analyzer.framework.JarCollection; 8 import java.util.*; 9 10 public class TestJarCollection extends TestCase { 11 public void testBuildJarCollection() throws Exception { 12 JarCollection jarCollection = new JarCollectionImpl(new File("testdata/acyclictestproject/dist")); 13 assertEquals(jarCollection.getJarCount(),2); 15 16 } 17 18 public void testFindPackage() throws Exception { 19 JarCollection jarCollection = new JarCollectionImpl(new File("testdata/acyclictestproject/dist")); 20 Jar jar = jarCollection.getJarContainingPackage("com.kirkk.analyzer.jar1.test1"); 21 assertEquals(jar.getJarFileName(), "Test1.jar"); 22 } 23 24 25 32 33 public void testIgnoredJars() throws Exception { 34 List ignoredJars = new ArrayList(); 35 ignoredJars.add("Test2.jar"); 36 JarCollection jarCollection = new JarCollectionImpl(new File("testdata/acyclictestproject/dist"), new ArrayList(), ignoredJars); 37 assertEquals("Should ignore Jar2 - count should be 1", 1, jarCollection.getJarCount()); 39 40 assertNull("Collection should not contain Test2.jar", jarCollection.getJar("Test2.jar")); 41 } 42 43 public void testToArray() throws Exception { 44 JarCollection jarCollection = new JarCollectionImpl(new File("testdata/acyclictestproject/dist")); 45 Jar[] jar = jarCollection.toArray(); 46 assertEquals("Array size should be 2", 2, jar.length); 47 48 assertTrue( (jar[0].getJarFileName().equals("Test1.jar")) || (jar[0].getJarFileName().equals("Test2.jar"))); 49 } 50 } | Popular Tags |