Add additional tests for coverage

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131440 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-12-14 13:01:07 +00:00
parent c45a13dee2
commit daff346e09
3 changed files with 37 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.java,v 1.6 2003/12/03 12:59:36 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.java,v 1.7 2003/12/14 13:00:37 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -72,7 +72,7 @@ import org.apache.commons.collections.map.AbstractTestMap;
/**
* Abstract test class for {@link BidiMap} methods and contracts.
*
* @version $Revision: 1.6 $ $Date: 2003/12/03 12:59:36 $
* @version $Revision: 1.7 $ $Date: 2003/12/14 13:00:37 $
*
* @author Matthew Hawthorne
* @author Stephen Colebourne
@ -277,7 +277,13 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
//-----------------------------------------------------------------------
public void testBidiClear() {
if (isRemoveSupported() == false) return;
if (isRemoveSupported() == false) {
try {
makeFullBidiMap().clear();
fail();
} catch(UnsupportedOperationException ex) {}
return;
}
BidiMap map = makeFullBidiMap();
map.clear();
@ -294,13 +300,25 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
//-----------------------------------------------------------------------
public void testBidiRemove() {
if (isRemoveSupported() == false) return;
if (isRemoveSupported() == false) {
try {
makeFullBidiMap().remove(entries[0][0]);
fail();
} catch(UnsupportedOperationException ex) {}
try {
makeFullBidiMap().removeValue(entries[0][1]);
fail();
} catch(UnsupportedOperationException ex) {}
return;
}
remove(makeFullBidiMap(), entries[0][0]);
remove(makeFullBidiMap().inverseBidiMap(), entries[0][1]);
removeValue(makeFullBidiMap(), entries[0][1]);
removeValue(makeFullBidiMap().inverseBidiMap(), entries[0][0]);
assertEquals(null, makeFullBidiMap().removeValue("NotPresent"));
}
private final void remove(BidiMap map, Object key) {

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java,v 1.5 2003/11/18 22:37:14 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java,v 1.6 2003/12/14 13:01:07 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -71,7 +71,7 @@ import org.apache.commons.collections.AbstractTestObject;
* overriding the supportsXxx() methods if necessary.
*
* @since Commons Collections 3.0
* @version $Revision: 1.5 $ $Date: 2003/11/18 22:37:14 $
* @version $Revision: 1.6 $ $Date: 2003/12/14 13:01:07 $
*
* @author Morgan Delagrange
* @author Stephen Colebourne
@ -169,6 +169,8 @@ public abstract class AbstractTestIterator extends AbstractTestObject {
} catch (NoSuchElementException e) {
}
verify();
assertNotNull(it.toString());
}
/**
@ -203,6 +205,8 @@ public abstract class AbstractTestIterator extends AbstractTestObject {
fail("NoSuchElementException must be thrown when Iterator is exhausted");
} catch (NoSuchElementException e) {
}
assertNotNull(it.toString());
}
/**

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java,v 1.3 2003/12/07 01:21:51 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java,v 1.4 2003/12/14 13:01:07 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -159,7 +159,7 @@ import org.apache.commons.collections.set.AbstractTestSet;
* @author Rodney Waldhoff
* @author Paul Jack
* @author Stephen Colebourne
* @version $Revision: 1.3 $ $Date: 2003/12/07 01:21:51 $
* @version $Revision: 1.4 $ $Date: 2003/12/14 13:01:07 $
*/
public abstract class AbstractTestMap extends AbstractTestObject {
@ -1280,6 +1280,13 @@ public abstract class AbstractTestMap extends AbstractTestObject {
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();