cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections/map AbstractTestMap.java
scolebourne2004/04/09 07:45:38 Modified:collections/src/test/org/apache/commons/collections/map AbstractTestMap.java Log: Handle singleton maps in test class Revision ChangesPath 1.11 +3 -3 jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java Index: AbstractTestMap.java === RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- AbstractTestMap.java 9 Apr 2004 09:38:31 - 1.10 +++ AbstractTestMap.java 9 Apr 2004 14:45:38 - 1.11 @@ -1241,9 +1241,9 @@ public void testMapEntrySetIteratorEntrySetValue() { Object key1 = getSampleKeys()[0]; -Object key2 = getSampleKeys()[1]; +Object key2 = (getSampleKeys().length ==1 ? getSampleKeys()[0] : getSampleKeys()[1]); Object newValue1 = getNewSampleValues()[0]; -Object newValue2 = getNewSampleValues()[1]; +Object newValue2 = (getNewSampleValues().length ==1 ? getNewSampleValues()[0] : getNewSampleValues()[1]); resetFull(); // explicitly get entries as sample values/keys are connected for some maps - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections/map AbstractTestMap.java
scolebourne2004/01/24 13:48:27 Modified:collections/src/test/org/apache/commons/collections/map AbstractTestMap.java Log: Avoid some null-based tests in JDK1.2 Revision ChangesPath 1.7 +14 -4 jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java Index: AbstractTestMap.java === RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- AbstractTestMap.java 14 Jan 2004 21:34:34 - 1.6 +++ AbstractTestMap.java 24 Jan 2004 21:48:27 - 1.7 @@ -159,6 +159,16 @@ */ public abstract class AbstractTestMap extends AbstractTestObject { +/** + * JDK1.2 has bugs in null handling of Maps, especially HashMap.Entry.toString + * This avoids nulls for JDK1.2 + */ +private static final boolean JDK12; +static { +String str = System.getProperty(java.version); +JDK12 = str.startsWith(1.2); +} + // These instance variables are initialized with the reset method. // Tests for map methods that alter the map (put, putAll, remove) // first call reset() to create the map and its views; then perform @@ -304,7 +314,7 @@ hello, goodbye, we'll, see, you, all, again, key, key2, -(isAllowNullKey()) ? null : nonnullkey +(isAllowNullKey() !JDK12) ? null : nonnullkey }; return result; } @@ -346,7 +356,7 @@ Object[] result = new Object[] { blahv, foov, barv, bazv, tmpv, goshv, gollyv, geev, hellov, goodbyev, we'llv, seev, youv, allv, againv, -(isAllowNullValue()) ? null : nonnullvalue, +(isAllowNullValue() !JDK12) ? null : nonnullvalue, value, (isAllowDuplicateValues()) ? value : value2, }; @@ -366,7 +376,7 @@ */ public Object[] getNewSampleValues() { Object[] result = new Object[] { -(isAllowNullValue() isAllowDuplicateValues()) ? null : newnonnullvalue, +(isAllowNullValue() !JDK12 isAllowDuplicateValues()) ? null : newnonnullvalue, newvalue, (isAllowDuplicateValues()) ? newvalue : newvalue2, newblahv, newfoov, newbarv, newbazv, newtmpv, newgoshv, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections/map AbstractTestMap.java
scolebourne2003/12/29 11:46:19 Modified:collections/src/test/org/apache/commons/collections/map AbstractTestMap.java Log: Improve documentation and error messages Revision ChangesPath 1.5 +8 -8 jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java Index: AbstractTestMap.java === RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- AbstractTestMap.java 14 Dec 2003 13:01:07 - 1.4 +++ AbstractTestMap.java 29 Dec 2003 19:46:19 - 1.5 @@ -381,8 +381,8 @@ } /** - * Helper method to add all the mappings described by [EMAIL PROTECTED] - * #getSampleKeys()} and [EMAIL PROTECTED] #getSampleValues()}. + * Helper method to add all the mappings described by + * [EMAIL PROTECTED] #getSampleKeys()} and [EMAIL PROTECTED] #getSampleValues()}. */ public void addSampleMappings(Map m) { @@ -398,11 +398,11 @@ keys[i] == null || values[i] == null); assertTrue(NullPointerException on null key, but + - isNullKeySupported is not overridden to return false., + isAllowNullKey is not overridden to return false., keys[i] == null || !isAllowNullKey()); assertTrue(NullPointerException on null value, but + - isNullValueSupported is not overridden to return false., + isAllowNullValue is not overridden to return false., values[i] == null || !isAllowNullValue()); assertTrue(Unknown reason for NullPointer., false); @@ -422,8 +422,8 @@ /** * Return a new, populated map. The mappings in the map should match the - * keys and values returned from [EMAIL PROTECTED] #getSampleKeys()} and [EMAIL PROTECTED] - * #getSampleValues()}. The default implementation uses makeEmptyMap() + * keys and values returned from [EMAIL PROTECTED] #getSampleKeys()} and + * [EMAIL PROTECTED] #getSampleValues()}. The default implementation uses makeEmptyMap() * and calls [EMAIL PROTECTED] #addSampleMappings} to add all the mappings to the * map. * - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections/map AbstractTestMap.java
scolebourne2003/12/14 05:01:07 Modified:collections/src/test/org/apache/commons/collections/iterators AbstractTestIterator.java collections/src/test/org/apache/commons/collections/map AbstractTestMap.java Log: Add additional tests for coverage Revision ChangesPath 1.6 +6 -2 jakarta-commons/collections/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java Index: AbstractTestIterator.java === RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- AbstractTestIterator.java 18 Nov 2003 22:37:14 - 1.5 +++ AbstractTestIterator.java 14 Dec 2003 13:01:07 - 1.6 @@ -169,6 +169,8 @@ } catch (NoSuchElementException e) { } verify(); + +assertNotNull(it.toString()); } /** @@ -203,6 +205,8 @@ fail(NoSuchElementException must be thrown when Iterator is exhausted); } catch (NoSuchElementException e) { } + +assertNotNull(it.toString()); } /** 1.4 +9 -2 jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java Index: AbstractTestMap.java === RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- AbstractTestMap.java 7 Dec 2003 01:21:51 - 1.3 +++ AbstractTestMap.java 14 Dec 2003 13:01:07 - 1.4 @@ -1280,6 +1280,13 @@ return entry; } +public void testMapEntrySetRemoveNonMapEntry() { +if (isRemoveSupported() == false) return; +resetFull(); +assertEquals(false, getSet().remove(null)); +assertEquals(false, getSet().remove(new Object())); +} + public void verify() { super.verify(); AbstractTestMap.this.verify(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]