FileDocCategorySizeDatePackage
TypeSelectorTest.javaAPI DocApache Ant 1.702610Wed Dec 13 06:16:20 GMT 2006org.apache.tools.ant.types.selectors

TypeSelectorTest

public class TypeSelectorTest extends BaseSelectorTest
Tests Type Selectors.

Fields Summary
Constructors Summary
public TypeSelectorTest(String name)

        super(name);
    
Methods Summary
public BaseSelectorgetInstance()
Factory method from base class. This is overriden in child classes to return a specific Selector class.

        return new TypeSelector();
    
public voidtestSelectionBehaviour()
Tests to make sure that the selector is selecting files correctly.

        TypeSelector s;
        String results;

        TypeSelector.FileType directory = new
                TypeSelector.FileType();
        directory.setValue("dir");
        TypeSelector.FileType file = new
                TypeSelector.FileType();
        file.setValue("file");

        try {
            makeBed();

            s = (TypeSelector)getInstance();
            s.setType(directory);
            results = selectionString(s);
            assertEquals("TFFFFFFFFFFT", results);

            s = (TypeSelector)getInstance();
            s.setType(file);
            results = selectionString(s);
            assertEquals("FTTTTTTTTTTF", results);


        }
        finally {
            cleanupBed();
        }

    
public voidtestValidate()
Test the code that validates the selector.

        TypeSelector s = (TypeSelector)getInstance();
        try {
            s.isSelected(basedir,filenames[0],files[0]);
            fail("TypeSelector did not check for required fields");
        } catch (BuildException be1) {
            assertEquals("The type attribute is required"
                    , be1.getMessage());
        }