Rule implements JsonObjectConvertible { public boolean matches(String value) { return getPattern().matcher(value).matches(); } Rule(final RuleType type, final Pattern pattern); @NotNull static JsonKeys keys(); RuleType getType(); Pattern getPattern(); boolean isInclude(); boolean isExclude(); boolean isAllow(); boolean isDeny(); boolean matches(String value); @Override JsonObject toJson(); @Override String toString(); @Override boolean equals(final Object o); @Override int hashCode();  }
@Test public void testMatches() { assertTrue("default matches all", Rules.DEFAULT_ALLOW.matches("/foo")); final Rule allowsDigits = new Rule(RuleType.ALLOW, Pattern.compile("[0-9]*")); assertTrue("allows digits matches digits", allowsDigits.matches("123")); assertFalse("allows digits doesn't match letters", allowsDigits.matches("abc")); }