GlobalIdentifier { public static String toString(final byte[] guid) { final ByteBuffer guidBuffer = ByteBuffer.wrap(guid); final StringBuilder sb = new StringBuilder("{"); guidBuffer.limit(4); sb.append(LdapUtils.hexEncode(getBytes(guidBuffer, true))); guidBuffer.limit(6); sb.append("-").append(LdapUtils.hexEncode(getBytes(guidBuffer, true))); guidBuffer.limit(8); sb.append("-").append(LdapUtils.hexEncode(getBytes(guidBuffer, true))); guidBuffer.limit(10); sb.append("-").append(LdapUtils.hexEncode(getBytes(guidBuffer, false))); guidBuffer.limit(guidBuffer.capacity()); sb.append("-").append(LdapUtils.hexEncode(getBytes(guidBuffer, false))); sb.append("}"); return sb.toString(); } private  GlobalIdentifier(); static String toString(final byte[] guid); static byte[] toBytes(final String guid);  }
@Test(groups = "ad", dataProvider = "guids") public void testToString(final String guidString, final byte[] guid) throws Exception { Assert.assertEquals(GlobalIdentifier.toString(guid), guidString); }