Hello there... I've been writing an implementation of SortedMap that doesn't have concrete objects for keys, but instead reconstructs them on the fly where Entry<K, V> instances are required. Wanting a good test suite for them, I've been re-using yours. :-)
The key objects satisfy the contract as far as .equals() and .hashCode() go ; but some of the tests compare keys with the JUnit Assert.assertSame() method, e.g. in AbstractTestSortedMap.testFirstKey(), and hence fail because they receive two keys that are different objects even where key1.equals(key2). I can of course, override the tests to behave as I wish, but would it be more correct to use assertEqual() to check key equality, or use the defined comparator if present? The test acknowledges the existence of sorted maps that use a Comparator also (by providing testComparator(), which contains no substantive tests). If the key equality tests are worked over it would seem to be a useful opportunity to provide some abstract methods to allow the provision (and use) of a comparator for key tests also. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
