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:
parent
c45a13dee2
commit
daff346e09
|
@ -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
|
* 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.
|
* 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 Matthew Hawthorne
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
|
@ -277,7 +277,13 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
public void testBidiClear() {
|
public void testBidiClear() {
|
||||||
if (isRemoveSupported() == false) return;
|
if (isRemoveSupported() == false) {
|
||||||
|
try {
|
||||||
|
makeFullBidiMap().clear();
|
||||||
|
fail();
|
||||||
|
} catch(UnsupportedOperationException ex) {}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BidiMap map = makeFullBidiMap();
|
BidiMap map = makeFullBidiMap();
|
||||||
map.clear();
|
map.clear();
|
||||||
|
@ -294,13 +300,25 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
public void testBidiRemove() {
|
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(), entries[0][0]);
|
||||||
remove(makeFullBidiMap().inverseBidiMap(), entries[0][1]);
|
remove(makeFullBidiMap().inverseBidiMap(), entries[0][1]);
|
||||||
|
|
||||||
removeValue(makeFullBidiMap(), entries[0][1]);
|
removeValue(makeFullBidiMap(), entries[0][1]);
|
||||||
removeValue(makeFullBidiMap().inverseBidiMap(), entries[0][0]);
|
removeValue(makeFullBidiMap().inverseBidiMap(), entries[0][0]);
|
||||||
|
|
||||||
|
assertEquals(null, makeFullBidiMap().removeValue("NotPresent"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void remove(BidiMap map, Object key) {
|
private final void remove(BidiMap map, Object key) {
|
||||||
|
|
|
@ -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
|
* The Apache Software License, Version 1.1
|
||||||
|
@ -71,7 +71,7 @@ import org.apache.commons.collections.AbstractTestObject;
|
||||||
* overriding the supportsXxx() methods if necessary.
|
* overriding the supportsXxx() methods if necessary.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @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 Morgan Delagrange
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
|
@ -169,6 +169,8 @@ public abstract class AbstractTestIterator extends AbstractTestObject {
|
||||||
} catch (NoSuchElementException e) {
|
} catch (NoSuchElementException e) {
|
||||||
}
|
}
|
||||||
verify();
|
verify();
|
||||||
|
|
||||||
|
assertNotNull(it.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -203,6 +205,8 @@ public abstract class AbstractTestIterator extends AbstractTestObject {
|
||||||
fail("NoSuchElementException must be thrown when Iterator is exhausted");
|
fail("NoSuchElementException must be thrown when Iterator is exhausted");
|
||||||
} catch (NoSuchElementException e) {
|
} catch (NoSuchElementException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assertNotNull(it.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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
|
* The Apache Software License, Version 1.1
|
||||||
|
@ -159,7 +159,7 @@ import org.apache.commons.collections.set.AbstractTestSet;
|
||||||
* @author Rodney Waldhoff
|
* @author Rodney Waldhoff
|
||||||
* @author Paul Jack
|
* @author Paul Jack
|
||||||
* @author Stephen Colebourne
|
* @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 {
|
public abstract class AbstractTestMap extends AbstractTestObject {
|
||||||
|
|
||||||
|
@ -1280,6 +1280,13 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testMapEntrySetRemoveNonMapEntry() {
|
||||||
|
if (isRemoveSupported() == false) return;
|
||||||
|
resetFull();
|
||||||
|
assertEquals(false, getSet().remove(null));
|
||||||
|
assertEquals(false, getSet().remove(new Object()));
|
||||||
|
}
|
||||||
|
|
||||||
public void verify() {
|
public void verify() {
|
||||||
super.verify();
|
super.verify();
|
||||||
AbstractTestMap.this.verify();
|
AbstractTestMap.this.verify();
|
||||||
|
|
Loading…
Reference in New Issue