SearchTerm implements Predicate<ValidatedRoaPrefix> { public boolean test(ValidatedRoaPrefix prefix) { return actualPredicate.test(prefix); } SearchTerm(String term); Long asAsn(); IpRange asIpRange(); String asString(); boolean test(ValidatedRoaPrefix prefix);  }
@Test public void should_test_asn() { assertThat(new SearchTerm("3642").test(asnTest)).isTrue(); assertThat(new SearchTerm("as3642").test(asnTest)).isTrue(); assertThat(new SearchTerm("AS3642").test(asnTest)).isTrue(); assertThat(new SearchTerm("AS364").test(asnTest)).isFalse(); assertThat(new SearchTerm("364").test(asnTest)).isFalse(); }
@Test public void should_test_single_address() { assertThat(new SearchTerm("10.0.0.0").test(prefixTest)).isTrue(); assertThat(new SearchTerm("12.0.0.0").test(prefixTest)).isFalse(); }
@Test public void should_test_prefix() { assertThat(new SearchTerm("10.10.0.0/16").test(prefixTest)).isTrue(); assertThat(new SearchTerm("11.10.0.0/16").test(prefixTest)).isFalse(); }
@Test public void should_test_generic() { assertThat(new SearchTerm("Bla").test(genericTest)).isTrue(); assertThat(new SearchTerm("bla").test(genericTest)).isFalse(); assertThat(new SearchTerm("3742").test(genericTest)).isFalse(); assertThat(new SearchTerm("locati").test(genericTest)).isTrue(); }