PIDUtils { public static boolean isDoi(String uri) { if (uri == null) { return false; } else { return DOI_PATTERN.matcher(uri).matches(); } }  static boolean isPid(String uri); static boolean isHandle(String uri); static boolean isDoi(String uri); static boolean isUrnNbn(String uri); static Optional<PIDType> getType(String uri); static String getSchemeSpecificId(String uri); static String getActionableLinkForPid(final String link); final static String HANDLE_PATTERN_STRING; final static int HANDLE_SCHEME_SPECIFIC_PART_GROUP; final static Pattern HANDLE_PATTERN; final static String DOI_PATTERN_STRING; final static int DOI_SCHEME_SPECIFIC_PART_GROUP; final static Pattern DOI_PATTERN; final static String URN_NBN_PATTERN_STRING; final static int URN_NBN_SCHEME_SPECIFIC_PART_GROUP; final static Pattern URN_NBN_PATTERN; final static Pattern PID_PATTERN; }
@Test public void testIsDoi() { VALID_DOIS.forEach(h -> assertTrue(h, PIDUtils.isDoi(h))); NOT_DOIS.forEach(h -> assertFalse(h, PIDUtils.isDoi(h))); NOT_PIDS.forEach(h -> assertFalse(h, PIDUtils.isDoi(h))); assertFalse("null", PIDUtils.isDoi(null)); }