public void testCycVariable() {
    System.out.println("\n*** testCycVariable ***");
    CycVariable cycVariable1 = VAR_X;
    assertNotNull(cycVariable1);
    assertEquals("?X", cycVariable1.toString());
    assertEquals("?X", cycVariable1.cyclify());
    assertEquals("'?X", cycVariable1.stringApiValue());
    CycVariable cycVariable2 = VAR_VARIABLE;
    assertNotNull(cycVariable2);
    assertEquals("?variable", cycVariable2.toString().toLowerCase());
    assertEquals("?variable", cycVariable2.cyclify().toLowerCase());
    assertEquals("'?variable", cycVariable2.stringApiValue().toLowerCase());
    CycVariable cycVariable3 = new CycVariable("?X");
    assertEquals(cycVariable1.toString(), cycVariable3.toString());
    assertEquals(cycVariable1.cyclify(), cycVariable3.cyclify());
    assertEquals(cycVariable1.stringApiValue(), cycVariable3.stringApiValue());
    assertEquals(cycVariable1, cycVariable3);

    // compareTo
    ArrayList variables = new ArrayList();
    variables.add(VAR_Y);
    variables.add(VAR_Z);
    variables.add(VAR_Y);
    variables.add(VAR_X);
    variables.add(VAR_Z);
    variables.add(VAR_X);
    Collections.sort(variables);
    assertEquals("[?X, ?X, ?Y, ?Y, ?Z, ?Z]", variables.toString().toUpperCase());
    CycVariable cycVariable1000 = new CycVariable(":X");
    assertNotSame(cycVariable1, cycVariable1000);

    try {
      testCycObjectRetrievable(VAR_0);
      testCycObjectRetrievable(VAR_X);
    } catch (Exception e) {
      failWithException(e);
    }

    // makeUniqueCycVariable
    CycVariable x = VAR_X;
    CycVariable x1 = CycObjectFactory.makeUniqueCycVariable(x);
    CycVariable x2 = CycObjectFactory.makeUniqueCycVariable(x);
    CycVariable x3 = CycObjectFactory.makeUniqueCycVariable(x);
    assertFalse((x.equals(x1)));
    assertFalse((x.equals(x2)));
    assertFalse((x.equals(x3)));
    assertFalse((x1.equals(x2)));
    assertTrue(x.cyclify().equals("?X"));
    assertTrue(x1.cyclify().startsWith("?X-"));
    assertTrue(x3.cyclify().startsWith("?X-"));

    // toXML, toXMLString, unmarshall
    XMLStringWriter xmlStringWriter = new XMLStringWriter();
    try {
      x.toXML(xmlStringWriter, 0, false);
      assertEquals("<variable>X</variable>\n", xmlStringWriter.toString());
      assertEquals("<variable>X</variable>\n", x.toXMLString());
      String cycVariableXMLString = x.toXMLString();
      CycObjectFactory.resetCycVariableCache();
      Object object = CycObjectFactory.unmarshall(cycVariableXMLString);
      assertTrue(object instanceof CycVariable);
      assertEquals(x, (CycVariable) object);
      assertTrue(CycObjectFactory.unmarshall(cycVariableXMLString)
              == CycObjectFactory.unmarshall(cycVariableXMLString));
    } catch (Exception e) {
      fail(e.getMessage());
    }

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