public void testGuid() {
    System.out.println("\n*** testGuid ***");
    CycObjectFactory.resetGuidCache();
    assertEquals(0, CycObjectFactory.getGuidCacheSize());
    String guidString = "bd58c19d-9c29-11b1-9dad-c379636f7270";
    Guid guid = CycObjectFactory.makeGuid(guidString);
    assertEquals(1, CycObjectFactory.getGuidCacheSize());
    assertEquals(guidString, guid.toString());
    Guid guid2 = CycObjectFactory.getGuidCache(guidString);
    assertEquals(guid, guid2);
    Guid guid3 = CycObjectFactory.makeGuid(guidString);
    assertEquals(guid, guid3);
    assertEquals(1, CycObjectFactory.getGuidCacheSize());

    // toXML, toXMLString, unmarshall
    XMLStringWriter xmlStringWriter = new XMLStringWriter();
    try {
      guid.toXML(xmlStringWriter, 0, false);
      assertEquals("<guid>bd58c19d-9c29-11b1-9dad-c379636f7270</guid>\n", xmlStringWriter.toString());
      assertEquals("<guid>bd58c19d-9c29-11b1-9dad-c379636f7270</guid>\n", guid.toXMLString());
      String guidXMLString = guid.toXMLString();
      CycObjectFactory.resetGuidCache();
      Object object = CycObjectFactory.unmarshall(guidXMLString);
      assertTrue(object instanceof Guid);
      assertEquals(guid, (Guid) object);
      assertTrue(CycObjectFactory.unmarshall(guidXMLString)
              == CycObjectFactory.unmarshall(guidXMLString));
    } catch (Exception e) {
      failWithException(e);
    }

    System.out.println("*** testGuid OK ***");
  }