Package org.codehaus.aspectwerkz.regexp

Examples of org.codehaus.aspectwerkz.regexp.ConstructorPattern


* @author <a href="mailto:jboner@codehaus.org">Jonas Bon�r</a>
*/
public class ConstructorPatternTest extends TestCase {

    public void testMatch1() {
        ConstructorPattern constructorPattern = Pattern.compileConstructorPattern("new(String, int)");
        assertTrue(constructorPattern.matchConstructorName("new"));
        assertFalse(constructorPattern.matchConstructorName("methods"));
        assertFalse(constructorPattern.matchConstructorName("meth"));
        assertFalse(constructorPattern.matchConstructorName(""));
    }
View Full Code Here


        assertFalse(constructorPattern.matchConstructorName("meth"));
        assertFalse(constructorPattern.matchConstructorName(""));
    }

    public void testMatch2() {
        ConstructorPattern constructorPattern = Pattern.compileConstructorPattern("new(..)");
        assertTrue(constructorPattern.matchConstructorName("new"));
        assertFalse(constructorPattern.matchConstructorName("news"));
        assertFalse(constructorPattern.matchConstructorName(""));
    }
View Full Code Here

        assertFalse(constructorPattern.matchConstructorName("news"));
        assertFalse(constructorPattern.matchConstructorName(""));
    }

    public void testMatchParameterTypes1() {
        ConstructorPattern constructorPattern = Pattern.compileConstructorPattern("new(java.lang.String,..)");
        assertTrue(
                constructorPattern.matchParameterTypes(new String[]{"java.lang.String", "java.lang.String", "int"})
        );
        assertFalse(constructorPattern.matchParameterTypes(new String[]{"java.lang.String"}));
        assertFalse(constructorPattern.matchParameterTypes(new String[]{}));
    }
View Full Code Here

        assertFalse(constructorPattern.matchParameterTypes(new String[]{"java.lang.String"}));
        assertFalse(constructorPattern.matchParameterTypes(new String[]{}));
    }

    public void testMatchParameterTypes2() {
        ConstructorPattern constructorPattern = Pattern.compileConstructorPattern("new(*)");
        assertFalse(
                constructorPattern.matchParameterTypes(new String[]{"java.lang.String", "java.lang.String", "int"})
        );
        assertTrue(constructorPattern.matchParameterTypes(new String[]{"java.lang.String"}));
        assertFalse(constructorPattern.matchParameterTypes(new String[]{}));
    }
View Full Code Here

        assertTrue(constructorPattern.matchParameterTypes(new String[]{"java.lang.String"}));
        assertFalse(constructorPattern.matchParameterTypes(new String[]{}));
    }

    public void testMatchParameterTypes3() {
        ConstructorPattern constructorPattern = Pattern.compileConstructorPattern("new(..)");
        assertTrue(
                constructorPattern.matchParameterTypes(new String[]{"java.lang.String", "java.lang.String", "int"})
        );
        assertTrue(constructorPattern.matchParameterTypes(new String[]{"java.lang.String"}));
        assertTrue(constructorPattern.matchParameterTypes(new String[]{}));
    }
View Full Code Here

        assertTrue(constructorPattern.matchParameterTypes(new String[]{"java.lang.String"}));
        assertTrue(constructorPattern.matchParameterTypes(new String[]{}));
    }

    public void testMatchParameterTypes4() {
        ConstructorPattern constructorPattern = Pattern.compileConstructorPattern("new(java.lang.*)");
        assertFalse(
                constructorPattern.matchParameterTypes(new String[]{"java.lang.String", "java.lang.StringBuffer"})
        );
        assertTrue(constructorPattern.matchParameterTypes(new String[]{"java.lang.String"}));
        assertTrue(constructorPattern.matchParameterTypes(new String[]{"java.lang.StringBuffer"}));
        assertFalse(constructorPattern.matchParameterTypes(new String[]{}));
    }
View Full Code Here

        assertTrue(constructorPattern.matchParameterTypes(new String[]{"java.lang.StringBuffer"}));
        assertFalse(constructorPattern.matchParameterTypes(new String[]{}));
    }

    public void testMatchParameterTypes5() {
        ConstructorPattern constructorPattern = Pattern.compileConstructorPattern("new(*,String)");
        assertTrue(constructorPattern.matchParameterTypes(new String[]{"java.lang.String", "java.lang.String"}));
        assertFalse(constructorPattern.matchParameterTypes(new String[]{"java.lang.String"}));
        assertFalse(constructorPattern.matchParameterTypes(new String[]{}));
    }
View Full Code Here

        assertFalse(constructorPattern.matchParameterTypes(new String[]{"java.lang.String"}));
        assertFalse(constructorPattern.matchParameterTypes(new String[]{}));
    }

    public void testMatchParameterTypes6() {
        ConstructorPattern constructorPattern = Pattern.compileConstructorPattern("new()");
        assertFalse(constructorPattern.matchParameterTypes(new String[]{"java.lang.String", "java.lang.String"}));
        assertFalse(constructorPattern.matchParameterTypes(new String[]{"java.lang.String"}));
        assertTrue(constructorPattern.matchParameterTypes(new String[]{}));
    }
View Full Code Here

        assertFalse(constructorPattern.matchParameterTypes(new String[]{"java.lang.String"}));
        assertTrue(constructorPattern.matchParameterTypes(new String[]{}));
    }

    public void testMatchParameterTypes7() {
        ConstructorPattern constructorPattern = Pattern.compileConstructorPattern("new(String, List)");
        assertTrue(constructorPattern.matchParameterTypes(new String[]{"java.lang.String", "java.util.List"}));
        assertFalse(constructorPattern.matchParameterTypes(new String[]{"java.lang.String"}));
    }
View Full Code Here

        assertTrue(constructorPattern.matchParameterTypes(new String[]{"java.lang.String", "java.util.List"}));
        assertFalse(constructorPattern.matchParameterTypes(new String[]{"java.lang.String"}));
    }

    public void testMatchParameterTypes8() {
        ConstructorPattern constructorPattern = Pattern.compileConstructorPattern("new(String, ..)");
        assertTrue(constructorPattern.matchParameterTypes(new String[]{"java.lang.String", "java.util.List"}));
        assertTrue(constructorPattern.matchParameterTypes(new String[]{"java.lang.String", "java.util.List", "int"}));
        assertFalse(constructorPattern.matchParameterTypes(new String[]{"java.lang.String"}));
    }
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.regexp.ConstructorPattern

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.