void () { String s1 = """ class A { int a; private char b; private char b2; public int c; public int c2; }"""; assertEquals("Finding package-private dcls",1, findMatchesCount(s1, "@Modifier(\"packageLocal\") '_Type '_Variable = '_Value?;")); assertEquals("Finding package-private dcls",3, findMatchesCount(s1, "@Modifier({\"packageLocal\",\"private\"}) '_Type '_Variable = '_Value?;")); try { findMatchesCount(s1, "@Modifier({\"PackageLocal\",\"private\"}) '_Type '_Variable = '_Value?;"); fail("Finding package-private dcls"); } catch(MalformedPatternException ignored) {} String s3 = """ class A { int a; static char b; static char b2; }"""; assertEquals("Finding instance fields",1, findMatchesCount(s3, "@Modifier(\"Instance\") '_Type '_Variable = '_Value?;")); assertEquals("Finding all fields",3, findMatchesCount(s3, "@Modifier({\"static\",\"Instance\"}) '_Type '_Variable = '_Value?;")); String s5 = """ class A {} abstract class B {} final class C {} class D {}"""; assertEquals("Finding instance classes",3,findMatchesCount(s5, "@Modifier(\"Instance\") class 'Type {}")); assertEquals("Finding all classes",4, findMatchesCount(s5, "@Modifier({\"abstract\",\"final\",\"Instance\"}) class 'Type {}")); }