@Test public void testParticularClassScreener() { Assert.assertTrue(particularClassScreener.matches(SOME_CLASS_FILENAME)); Assert.assertFalse(particularClassScreener.matches(SOME_OTHER_CLASS_FILENAME)); Assert.assertFalse(particularClassScreener.matches(UNRELATED_THING_CLASS_FILENAME)); Assert.assertTrue(particularClassScreener.matches(SOME_CLASS_JARFILENAME)); Assert.assertFalse(particularClassScreener.matches(SOME_OTHER_CLASS_JARFILENAME)); Assert.assertFalse(particularClassScreener.matches(UNRELATED_THING_CLASS_JARFILENAME)); }
@Override public boolean matches(String fileName) { if (patternList.isEmpty()) { return true; } LOG.debug("Matching: {}", fileName); for (Matcher matcher : patternList) { matcher.reset(fileName); if (matcher.find()) { LOG.debug("\\tTrying [{}]: yes!", matcher.pattern()); return true; } LOG.debug("\\tTrying [{}]: no", matcher.pattern()); } return false; }
ClassScreener implements IClassScreener { @Override public boolean matches(String fileName) { if (patternList.isEmpty()) { return true; } LOG.debug("Matching: {}", fileName); for (Matcher matcher : patternList) { matcher.reset(fileName); if (matcher.find()) { LOG.debug("\\tTrying [{}]: yes!", matcher.pattern()); return true; } LOG.debug("\\tTrying [{}]: no", matcher.pattern()); } return false; } }
ClassScreener implements IClassScreener { @Override public boolean matches(String fileName) { if (patternList.isEmpty()) { return true; } LOG.debug("Matching: {}", fileName); for (Matcher matcher : patternList) { matcher.reset(fileName); if (matcher.find()) { LOG.debug("\\tTrying [{}]: yes!", matcher.pattern()); return true; } LOG.debug("\\tTrying [{}]: no", matcher.pattern()); } return false; } ClassScreener(); }
ClassScreener implements IClassScreener { @Override public boolean matches(String fileName) { if (patternList.isEmpty()) { return true; } LOG.debug("Matching: {}", fileName); for (Matcher matcher : patternList) { matcher.reset(fileName); if (matcher.find()) { LOG.debug("\\tTrying [{}]: yes!", matcher.pattern()); return true; } LOG.debug("\\tTrying [{}]: no", matcher.pattern()); } return false; } ClassScreener(); void addAllowedClass(String className); void addAllowedPackage(String packageName); void addAllowedPrefix(String prefix); @Override boolean matches(String fileName); @Override boolean vacuous(); }
ClassScreener implements IClassScreener { @Override public boolean matches(String fileName) { if (patternList.isEmpty()) { return true; } LOG.debug("Matching: {}", fileName); for (Matcher matcher : patternList) { matcher.reset(fileName); if (matcher.find()) { LOG.debug("\\tTrying [{}]: yes!", matcher.pattern()); return true; } LOG.debug("\\tTrying [{}]: no", matcher.pattern()); } return false; } ClassScreener(); void addAllowedClass(String className); void addAllowedPackage(String packageName); void addAllowedPrefix(String prefix); @Override boolean matches(String fileName); @Override boolean vacuous();  }