@Test public void withDifferentCases2() { List<String> tokens = Arrays.asList("http: String origin = "HTTP: OriginMatchUtil matcher = new OriginMatchUtil(tokens); assertThat(matcher.matches(origin)).isTrue(); }
public boolean matches(String origin) { if(Objects.isNull(origin) || Objects.equals("", origin)) { return false; } Predicate<String> subdomainMatch = s -> origin.toLowerCase().matches(s); Predicate<String> matchingCritera = wildcardMatch.or(subdomainMatch); return tokens.stream().anyMatch(matchingCritera); }
OriginMatchUtil { public boolean matches(String origin) { if(Objects.isNull(origin) || Objects.equals("", origin)) { return false; } Predicate<String> subdomainMatch = s -> origin.toLowerCase().matches(s); Predicate<String> matchingCritera = wildcardMatch.or(subdomainMatch); return tokens.stream().anyMatch(matchingCritera); } }
OriginMatchUtil { public boolean matches(String origin) { if(Objects.isNull(origin) || Objects.equals("", origin)) { return false; } Predicate<String> subdomainMatch = s -> origin.toLowerCase().matches(s); Predicate<String> matchingCritera = wildcardMatch.or(subdomainMatch); return tokens.stream().anyMatch(matchingCritera); } OriginMatchUtil(List<String> tokens); }
OriginMatchUtil { public boolean matches(String origin) { if(Objects.isNull(origin) || Objects.equals("", origin)) { return false; } Predicate<String> subdomainMatch = s -> origin.toLowerCase().matches(s); Predicate<String> matchingCritera = wildcardMatch.or(subdomainMatch); return tokens.stream().anyMatch(matchingCritera); } OriginMatchUtil(List<String> tokens); boolean matches(String origin); }
OriginMatchUtil { public boolean matches(String origin) { if(Objects.isNull(origin) || Objects.equals("", origin)) { return false; } Predicate<String> subdomainMatch = s -> origin.toLowerCase().matches(s); Predicate<String> matchingCritera = wildcardMatch.or(subdomainMatch); return tokens.stream().anyMatch(matchingCritera); } OriginMatchUtil(List<String> tokens); boolean matches(String origin);  }