[jbosscache-commits] JBoss Cache SVN: r5656 - in core/trunk/src: test/java/org/jboss/cache/factories and 1 other directory.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Thu Apr 24 06:36:20 EDT 2008
Author: mircea.markus
Date: 2008-04-24 06:36:20 -0400 (Thu, 24 Apr 2008)
New Revision: 5656
Modified:
core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java
core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java
Log:
JBCACHE-1222 - fixed interceptor chain tests
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java 2008-04-24 10:22:15 UTC (rev 5655)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java 2008-04-24 10:36:20 UTC (rev 5656)
@@ -50,7 +50,7 @@
/**
* Inserts the given interceptor at the specified position in the chain (o based indexing).
- * If the position is invalid (e.g. 5 and there are only 2 interceptors in the chain) this is a no-op.
+ * @throws IllegalArgumentException if the position is invalid (e.g. 5 and there are only 2 interceptors in the chain)
*/
public synchronized void addInterceptor(ChainedInterceptor interceptor, int position)
{
@@ -72,13 +72,13 @@
return;
}
it = it.getNext();
-
}
+ throw new IllegalArgumentException("Invalid index: " + index + " !");
}
/**
* Removes the interceptor at the given postion.
- * If the position is invalid (e.g. 5 and there are only 2 interceptors in the chain) this is a no-op.
+ * @throws IllegalArgumentException if the position is invalid (e.g. 5 and there are only 2 interceptors in the chain)
*/
public synchronized void removeInterceptor(int position)
{
@@ -96,9 +96,11 @@
{
if (it.getNext() == null) return; //nothing to remove
it.setNext(it.getNext().getNext());
+ return;
}
it = it.getNext();
}
+ throw new IllegalArgumentException("Invalid position: " + position + " !");
}
/**
Modified: core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java 2008-04-24 10:22:15 UTC (rev 5655)
+++ core/trunk/src/test/java/org/jboss/cache/factories/CustomInterceptorChainTest.java 2008-04-24 10:36:20 UTC (rev 5656)
@@ -111,7 +111,7 @@
cache.addInterceptor(x, 9);
fail("Should throw an exception");
}
- catch (IndexOutOfBoundsException e)
+ catch (IllegalArgumentException e)
{
// expected
}
@@ -176,7 +176,7 @@
cache.removeInterceptor(9);
fail("Should throw an exception");
}
- catch (IndexOutOfBoundsException e)
+ catch (IllegalArgumentException e)
{
// expected
}
More information about the jbosscache-commits
mailing list