UuidUtil { @Deprecated public static UUID getUuidFromUrn(final String urn) { if (StringUtils.isNotBlank(urn) && urn.startsWith(URN_PREFIX_UUID)) { return UUID.fromString(StringUtils.substringAfterLast(urn, URN_SEPARATOR)); } throw new IllegalArgumentException(String.format("Invalid URN: %s", urn)); }  @Deprecated static UUID getUuidFromUrn(final String urn); @Deprecated static String getUrnFromUuid(final UUID referenceUuid); @Deprecated static UUID getUuidFromAccountUrn(final String urn); @Deprecated static String getAccountUrnFromUuid(final UUID referenceUuid); @Deprecated static UUID getNewUuid(); @Deprecated static String getNewUuidAsString(); static final String URN_SEPARATOR; static final String URN_PREFIX; static final String URN_PREFIX_ACCOUNT; static final String URN_PREFIX_UUID; }
@Test public void testGetUuidFromUrn() throws Exception { UUID expectedResult = UUID.randomUUID(); UUID actualResult = UuidUtil.getUuidFromUrn(UuidUtil.URN_PREFIX_UUID + expectedResult); assertTrue("The expected result '" + expectedResult + "' did not match the actual result '" + actualResult + ".", expectedResult.equals(actualResult)); }
@Test(expected = IllegalArgumentException.class) public void testGetUuidFromUrn_Null() throws Exception { UuidUtil.getUuidFromUrn(null); }
@Test(expected = IllegalArgumentException.class) public void testGetUuidFromUrn_NullString() throws Exception { UuidUtil.getUuidFromUrn(""); }
@Test(expected = IllegalArgumentException.class) public void testGetUuidFromUrn_BlankString() throws Exception { UuidUtil.getUuidFromUrn(" "); }