1 package test.net.sourceforge.pmd.jaxen; 2 3 import net.sourceforge.pmd.Rule; 4 import net.sourceforge.pmd.rules.XPathRule; 5 import test.net.sourceforge.pmd.testframework.RuleTst; 6 7 public class RegexpAcceptanceTest extends RuleTst { 8 9 public void testSimple() throws Throwable { 10 Rule r = new XPathRule(); 11 r.addProperty("xpath", "//ClassOrInterfaceDeclaration[matches(@Image, 'F?o')]"); 12 r.setMessage(""); 13 runTestFromString(TEST1, 1, r); 14 runTestFromString(TEST2, 0, r); 15 runTestFromString(TEST3, 1, r); 16 } 17 18 private static final String TEST1 = 19 "public class Foo {}"; 20 21 private static final String TEST2 = 22 "public class Bar {}"; 23 24 private static final String TEST3 = 25 "public class Flo {}"; 26 }