FileDocCategorySizeDatePackage
ClasspathUtilsTest.javaAPI DocApache Ant 1.702059Wed Dec 13 06:16:22 GMT 2006org.apache.tools.ant.util

ClasspathUtilsTest

public class ClasspathUtilsTest extends TestCase
Test case for ClasspathUtils

Fields Summary
private org.apache.tools.ant.Project
p
Constructors Summary
public ClasspathUtilsTest(String name)

        super(name);
    
Methods Summary
public voidsetUp()

        p = new Project();
        p.init();
    
public voidtestOnlyOneInstance()

        Enumeration enumeration;
        String list = "";
        ClassLoader c = ClasspathUtils.getUniqueClassLoaderForPath(p, (Path) null, false);
        try {
            enumeration = c.getResources(
                "org/apache/tools/ant/taskdefs/defaults.properties");
        } catch (IOException e) {
            throw new BuildException(
                "Could not get the defaults.properties resource");
        }
        int count = 0;
        while (enumeration.hasMoreElements()) {
            list = list + " " + enumeration.nextElement();
            count++;
        }
        assertTrue("Should be only one and not " + count + " " + list, count == 1);