FileDocCategorySizeDatePackage
RegexpTest.javaAPI DocApache Ant 1.702288Wed Dec 13 06:16:24 GMT 2006org.apache.tools.ant.util.regexp

RegexpTest

public abstract class RegexpTest extends RegexpMatcherTest
Tests for all implementations of the Regexp interface.

Fields Summary
private static final String
test
private static final String
pattern
Constructors Summary
public RegexpTest(String name)


       
        super(name);
    
Methods Summary
public final RegexpMatchergetImplementation()

        return getRegexpImplementation();
    
public abstract RegexpgetRegexpImplementation()

public voidtestReplaceAllSubstitution()

        Regexp reg = (Regexp) getReg();
        reg.setPattern(pattern);
        assertTrue(reg.matches(test));
        assertEquals("abedcfg-abedcfg", reg.substitute(test, "ab\\2d\\1f",
                                                       Regexp.REPLACE_ALL));
    
public voidtestReplaceFirstSubstitution()

        Regexp reg = (Regexp) getReg();
        reg.setPattern(pattern);
        assertTrue(reg.matches(test));
        assertEquals("abedcfg-abcdefg", reg.substitute(test, "ab\\2d\\1f",
                                                       Regexp.REPLACE_FIRST));
    
public voidtestSubstitution()

        Regexp reg = (Regexp) getReg();
        reg.setPattern(pattern);
        assertTrue(reg.matches(test));
        assertEquals("abedcfg-abcdefg", reg.substitute(test, "ab\\2d\\1f",
                                                       Regexp.MATCH_DEFAULT));