Correct errors in testing exceptions

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131317 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-11-02 18:29:33 +00:00
parent 60fcc4fb8d
commit b4f545f3f3
1 changed files with 12 additions and 2 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/Attic/AbstractTestBidiMap.java,v 1.5 2003/11/02 15:27:54 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/AbstractTestBidiMap.java,v 1.6 2003/11/02 18:29:33 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -69,7 +69,7 @@ import org.apache.commons.collections.iterators.MapIterator;
/** /**
* Abstract test class for {@link BidiMap} methods and contracts. * Abstract test class for {@link BidiMap} methods and contracts.
* *
* @version $Revision: 1.5 $ $Date: 2003/11/02 15:27:54 $ * @version $Revision: 1.6 $ $Date: 2003/11/02 18:29:33 $
* *
* @author Matthew Hawthorne * @author Matthew Hawthorne
* @author Stephen Colebourne * @author Stephen Colebourne
@ -482,25 +482,31 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
assertEquals(false, it.hasNext()); assertEquals(false, it.hasNext());
try { try {
it.next(); it.next();
fail();
} catch (NoSuchElementException ex) {} } catch (NoSuchElementException ex) {}
try { try {
it.getKey(); it.getKey();
fail();
} catch (IllegalStateException ex) { } catch (IllegalStateException ex) {
} }
try { try {
it.getValue(); it.getValue();
fail();
} catch (IllegalStateException ex) { } catch (IllegalStateException ex) {
} }
try { try {
it.remove(); it.remove();
fail();
} catch (IllegalStateException ex) { } catch (IllegalStateException ex) {
} }
try { try {
it.setValue(null); it.setValue(null);
fail();
} catch (IllegalStateException ex) { } catch (IllegalStateException ex) {
} }
try { try {
it.asMapEntry(); it.asMapEntry();
fail();
} catch (IllegalStateException ex) { } catch (IllegalStateException ex) {
} }
verify(); verify();
@ -550,6 +556,7 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
if (isRemoveSupported() == false) { if (isRemoveSupported() == false) {
try { try {
it.remove(); it.remove();
fail();
} catch (UnsupportedOperationException ex) { } catch (UnsupportedOperationException ex) {
} }
return; return;
@ -581,6 +588,7 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
if (isSetValueSupported() == false) { if (isSetValueSupported() == false) {
try { try {
it.setValue(newValue1); it.setValue(newValue1);
fail();
} catch (UnsupportedOperationException ex) { } catch (UnsupportedOperationException ex) {
} }
return; return;
@ -618,6 +626,7 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
// key1=newValue1, key2=newValue2 // key1=newValue1, key2=newValue2
try { try {
it.setValue(newValue1); // should remove key1 it.setValue(newValue1); // should remove key1
fail();
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
return; // simplest way of dealing with tricky situation return; // simplest way of dealing with tricky situation
} }
@ -661,6 +670,7 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
try { try {
it.setValue(newValue1); it.setValue(newValue1);
fail();
} catch (IllegalStateException ex) { } catch (IllegalStateException ex) {
} }
verify(); verify();