@Test public void normalizeTest() { WikidataValidator validator = new WikidataValidator(); assertEquals( "https: validator.normalize("https: assertEquals( "https: validator.normalize("https: assertEquals( "https: validator.normalize("https: assertEquals( "http: validator.normalize("http: assertEquals( "http: validator.normalize("http: assertEquals( "http: validator.normalize("http: assertEquals( "wikidata.org/wiki/Property:P569", validator.normalize("wikidata.org/wiki/Property:P569")); assertEquals( "www.wikidata.org/wiki/Lexeme:L1", validator.normalize("www.wikidata.org/wiki/Lexeme:L1")); assertEquals("www.wikidata.org/entity/ID", validator.normalize("www.wikidata.org/entity/ID")); }
@Override public String normalize(String value) { Preconditions.checkNotNull(value, "Identifier value can't be null"); String trimmedValue = value.trim(); Matcher matcher = WIKIDATA_PATTERN.matcher(trimmedValue); if (matcher.matches()) { return value; } throw new IllegalArgumentException(value + " it not a valid Wikidata"); }
WikidataValidator implements IdentifierSchemeValidator { @Override public String normalize(String value) { Preconditions.checkNotNull(value, "Identifier value can't be null"); String trimmedValue = value.trim(); Matcher matcher = WIKIDATA_PATTERN.matcher(trimmedValue); if (matcher.matches()) { return value; } throw new IllegalArgumentException(value + " it not a valid Wikidata"); } }
WikidataValidator implements IdentifierSchemeValidator { @Override public String normalize(String value) { Preconditions.checkNotNull(value, "Identifier value can't be null"); String trimmedValue = value.trim(); Matcher matcher = WIKIDATA_PATTERN.matcher(trimmedValue); if (matcher.matches()) { return value; } throw new IllegalArgumentException(value + " it not a valid Wikidata"); }  }
WikidataValidator implements IdentifierSchemeValidator { @Override public String normalize(String value) { Preconditions.checkNotNull(value, "Identifier value can't be null"); String trimmedValue = value.trim(); Matcher matcher = WIKIDATA_PATTERN.matcher(trimmedValue); if (matcher.matches()) { return value; } throw new IllegalArgumentException(value + " it not a valid Wikidata"); }  @Override boolean isValid(String value); @Override String normalize(String value); }
WikidataValidator implements IdentifierSchemeValidator { @Override public String normalize(String value) { Preconditions.checkNotNull(value, "Identifier value can't be null"); String trimmedValue = value.trim(); Matcher matcher = WIKIDATA_PATTERN.matcher(trimmedValue); if (matcher.matches()) { return value; } throw new IllegalArgumentException(value + " it not a valid Wikidata"); }  @Override boolean isValid(String value); @Override String normalize(String value);  }