Package org.jasig.portal.groups.pags.testers

Examples of org.jasig.portal.groups.pags.testers.RegexTester


   
    msg = "Testing IPerson " + newPerson;
    print(msg);

    //  test equals attribute.  Should return true.
    IPersonTester tester1 = new RegexTester(key1, randomStrings[0]);
   
    // test and attribute begin with same String.  Should return true.
    String testValue2 = randomStrings[0].substring(0,1) + ".*";
    IPersonTester tester2 = new RegexTester(key1, testValue2);
   
    // test and attribute begin with different String.  Should return false.
    String testValue3 = "^[0]";
    IPersonTester tester3 = new RegexTester(key1, testValue3);
   
    //  test and attribute end with same String.  Should return true.
     String testValue4 = ".*" + randomStrings[1].substring(randomStrings[1].length() - 1) + "$";
     IPersonTester tester4 = new RegexTester(key2, testValue4);
   
     // test and attribute end with different String.  Should return false.
     String testValue5 = ".*9$";
     IPersonTester tester5 = new RegexTester(key2, testValue5);
    
     // test value is same as last String in Vector.  Should return true.
     String testValue6 = "^" + ((String)stringVector.lastElement()) + "$";
     IPersonTester tester6 = new RegexTester(key3, testValue6);
    
    msg = "Testing " + tester1;
    assertTrue(msg, tester1.test(newPerson));
    msg = "Testing " + tester2;
    assertTrue(msg, tester2.test(newPerson));
    msg = "Testing " + tester3;
    assertFalse(msg, tester3.test(newPerson));
    msg = "Testing " + tester4;
    assertTrue(msg, tester4.test(newPerson));
    msg = "Testing " + tester5;
    assertFalse(msg, tester5.test(newPerson));
    msg = "Testing " + tester6;
    assertTrue(msg, tester6.test(newPerson));

    print("Success!");
    print(CR + "***** LEAVING PAGSTester.testRegexTester() *****" + CR);

View Full Code Here


   
    msg = "Testing IPerson " + newPerson;
    print(msg);

    //  test equals attribute.  Should return true.
    IPersonTester tester1 = new RegexTester(key1, randomStrings[0]);
   
    // test and attribute begin with same String.  Should return true.
    String testValue2 = randomStrings[0].substring(0,1) + ".*";
    IPersonTester tester2 = new RegexTester(key1, testValue2);
   
    // test and attribute begin with different String.  Should return false.
    String testValue3 = "^[0]";
    IPersonTester tester3 = new RegexTester(key1, testValue3);
   
    //  test and attribute end with same String.  Should return true.
     String testValue4 = ".*" + randomStrings[1].substring(randomStrings[1].length() - 1) + "$";
     IPersonTester tester4 = new RegexTester(key2, testValue4);
   
     // test and attribute end with different String.  Should return false.
     String testValue5 = ".*9$";
     IPersonTester tester5 = new RegexTester(key2, testValue5);
    
     // test value is same as last String in Vector.  Should return true.
     String testValue6 = "^" + ((String)stringVector.lastElement()) + "$";
     IPersonTester tester6 = new RegexTester(key3, testValue6);
    
    msg = "Testing " + tester1;
    assertTrue(msg, tester1.test(newPerson));
    msg = "Testing " + tester2;
    assertTrue(msg, tester2.test(newPerson));
    msg = "Testing " + tester3;
    assertFalse(msg, tester3.test(newPerson));
    msg = "Testing " + tester4;
    assertTrue(msg, tester4.test(newPerson));
    msg = "Testing " + tester5;
    assertFalse(msg, tester5.test(newPerson));
    msg = "Testing " + tester6;
    assertTrue(msg, tester6.test(newPerson));

    print("Success!");
    print(CR + "***** LEAVING PAGSTester.testRegexTester() *****" + CR);

View Full Code Here

        person.setAttribute(intAttributeName, nums);
    }
   
    @Test
    public void testMultivaluedRegex() {
        IPersonTester tester = new RegexTester(strAttributeName, ".*somewhere.*");
        assertTrue(tester.test(person));
       
        tester = new RegexTester(strAttributeName, ".*nowhere.*");
        assertFalse(tester.test(person));
    }
View Full Code Here

TOP

Related Classes of org.jasig.portal.groups.pags.testers.RegexTester

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.