@Override
    public boolean equals(Object obj)
    {
        if (obj instanceof COSString)
        {
            COSString strObj = (COSString) obj;
            return getString().equals(strObj.getString()) &&
                   forceHexForm == strObj.forceHexForm;
        }
        return false;
    }
@Test
    void testEquals()
    {
        // Check all these several times for consistency
        for (int i = 0; i < 10; i++)
        {
            // Reflexive
            COSString x1 = new COSString("Test");
            assertEquals(x1, x1);

            // Symmetry i.e. if x == y then y == x
            COSString y1 = new COSString("Test");
            assertEquals(x1, y1);
            assertEquals(y1, x1);
            COSString x2 = new COSString("Test", true);
            // also if x != y then y != x
            assertNotEquals(x1, x2);
            assertNotEquals(x2, x1);

            // Transitive if x == y && y == z then x == z
            COSString z1 = new COSString("Test");
            assertEquals(x1, y1);
            assertEquals(y1, z1);
            assertEquals(x1, z1);
            // Test the negative as well if x1 == y1 && y1 != x2 then x1 != x2
            assertEquals(x1, y1);
            assertNotEquals(y1, x2);
            assertNotEquals(x1, x2);
        }
    }