ObjectId implements Comparable<ObjectId>, ObjectIdentifiable, Serializable { @FromString public static ObjectId parse(String str) { ArgumentChecker.notEmpty(str, "str"); if (str.contains("~") == false) { str = StringUtils.replace(str, "::", "~"); } String[] split = StringUtils.splitByWholeSeparatorPreserveAllTokens(str, "~"); switch (split.length) { case 2: return ObjectId.of(split[0], split[1]); } throw new IllegalArgumentException("Invalid identifier format: " + str); } private  ObjectId(String scheme, String value); static ObjectId of(String scheme, String value); @FromString static ObjectId parse(String str); String getScheme(); String getValue(); ObjectId withScheme(final String scheme); ObjectId withValue(final String value); UniqueId atLatestVersion(); UniqueId atVersion(final String version); @Override ObjectId getObjectId(); @Override int compareTo(ObjectId other); @Override boolean equals(Object obj); @Override int hashCode(); @Override @ToString String toString(); static final ExternalScheme EXTERNAL_SCHEME; }
@Test(expectedExceptions = IllegalArgumentException.class) public void test_parse_invalidFormat1() { ObjectId.parse("Scheme"); }
@Test(expectedExceptions = IllegalArgumentException.class) public void test_parse_invalidFormat2() { ObjectId.parse("Scheme:value"); }
@Test(expectedExceptions = IllegalArgumentException.class) public void test_parse_invalidFormat3() { ObjectId.parse("Scheme~value~other"); }