{
@Test
public void UUIDs()
{
// Creation
UUID a = new UUID();
byte[] bytes = a.GetBytes();
for (int i = 0; i < 16; i++)
Assert.assertTrue(bytes[i] == 0x00);
// Comparison
a = new UUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
0x0B, 0x0C, 0x0D, 0x0E, 0x0F, (byte) 0xFF, (byte) 0xFF }, 0);
UUID b = new UUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);
Assert.assertTrue("UUID comparison operator failed, " + a.toString() + " should equal " +
b.toString(), a.equals(b));
// From String
a = new UUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);
String zeroonetwo = "00010203-0405-0607-0809-0a0b0c0d0e0f";
b = new UUID(zeroonetwo);
Assert.assertTrue("UUID hyphenated String constructor failed, should have " + a.toString() +
" but we got " + b.toString(), a.equals(b));
// ToString()
Assert.assertTrue(a.equals(b));
Assert.assertTrue(a.equals(UUID.Parse(zeroonetwo)));