public void testByteArray() {
    System.out.println("\n*** testByteArray ***");
    byte[] bytes = {0, 1, 2, 3, 4, -128};
    ByteArray byteArray1 = new ByteArray(bytes);
    assertNotNull(byteArray1);
    assertEquals(6, byteArray1.byteArrayValue().length);
    assertEquals(0, byteArray1.byteArrayValue()[0]);
    assertEquals(1, byteArray1.byteArrayValue()[1]);
    assertEquals(2, byteArray1.byteArrayValue()[2]);
    assertEquals(3, byteArray1.byteArrayValue()[3]);
    assertEquals(4, byteArray1.byteArrayValue()[4]);
    assertEquals(-128, byteArray1.byteArrayValue()[5]);
    byte[] bytes2 = {0, 1, 2, 3, 4, -128};
    ByteArray byteArray2 = new ByteArray(bytes2);
    assertEquals(byteArray1, byteArray1);
    assertEquals(byteArray1, byteArray2);
    byte[] bytes3 = {0, -1, 2, 3, 4, -128};
    ByteArray byteArray3 = new ByteArray(bytes3);
    assertFalse(byteArray1.equals(byteArray3));
    assertEquals("[ByteArray len:6 0,1,2,3,4,-128]", byteArray1.toString());

    // toXML, toXMLString, unmarshall
    XMLStringWriter xmlStringWriter = new XMLStringWriter();
    try {
      byteArray1.toXML(xmlStringWriter, 0, false);
      String expectedXmString =
              "<byte-vector>\n"
              + "  <length>6</length>\n"
              + "  <byte>0</byte>\n"
              + "  <byte>1</byte>\n"
              + "  <byte>2</byte>\n"
              + "  <byte>3</byte>\n"
              + "  <byte>4</byte>\n"
              + "  <byte>-128</byte>\n"
              + "</byte-vector>\n";

      assertEquals(expectedXmString, xmlStringWriter.toString());
      assertEquals(expectedXmString, byteArray1.toXMLString());
      assertEquals(byteArray1, CycObjectFactory.unmarshall(byteArray1.toXMLString()));
    } catch (Exception e) {
      failWithException(e);
    }
    System.out.println("*** testByteArray OK ***");
  }