OCID { public static boolean isValid(String ocid) { if (StringUtils.isBlank(ocid)) return false; return OCID_PATTERN.matcher(ocid).matches(); }  static boolean isValid(String ocid);  }
@Test public void validOcid() { assertTrue( OCID.isValid( "ocid1.user.oc1..aaaaaaaaizi8k3lbfv747ul6qwazrutncoe8zciazibypbjtkxaiecoic1dq")); }
@Test public void validLegacyOcid() { assertTrue( OCID.isValid( "ocidv1:tenancy:oc1:phx:1829406592360:aaaaaaaab4faaopv32ecohhklpvjq463pu")); }
@Test public void invalidOcid() { assertFalse(OCID.isValid("ocid1.user.oc1.")); assertFalse(OCID.isValid("ocid1.user.oc1.adsfasfsafdf")); assertFalse(OCID.isValid("ocid1.user.oc1.1354aasdf.")); assertFalse(OCID.isValid("ocid1.user.oc1.1354aasdf..")); }