Hi,

the hash code of two dictionaries does not have to be equals,
if the case is different.

So we should remove these lines:
assertEquals(dictB.hashCode(), dictC.hashCode());

and if that works its ok, but that could change:
assertEquals(dictC.hashCode(), dictD.hashCode())

Anyway the question is, do we consider two dictionaries
with a different case flag to be equals?

I believe we shouldn't because they behave different.
Any other opinions?

Jörn

On 8/16/11 4:15 AM, [email protected] wrote:
+  /**
     * Tests serialization and deserailization of the {@link Dictionary}.
     *
     * @throws IOException
@@ -154,14 +174,23 @@ public class DictionaryTest {
    @Test
    public void testHashCode() {
      StringList entry1 = new StringList(new String[]{"1a", "1b"});
+    StringList entry2 = new StringList(new String[]{"1A", "1B"});

      Dictionary dictA = getCaseInsensitive();
      dictA.put(entry1);

      Dictionary dictB = getCaseInsensitive();
-    dictB.put(entry1);
+    dictB.put(entry2);
+
+    Dictionary dictC = getCaseSensitive();
+    dictC.put(entry1);
+
+    Dictionary dictD = getCaseSensitive();
+    dictD.put(entry2);

      assertEquals(dictA.hashCode(), dictB.hashCode());
+    assertEquals(dictB.hashCode(), dictC.hashCode());
+    assertEquals(dictC.hashCode(), dictD.hashCode());
    }

Reply via email to