updated testcase
authorerik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Sun, 26 Mar 2006 20:15:33 +0000 (20:15 +0000)
committererik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Sun, 26 Mar 2006 20:15:33 +0000 (20:15 +0000)
.classpath
support/test/org/wamblee/observer/ObservableTest.java

index 1cec05af5c6038828cf942ff837ab146d6ebf6cf..4c7b227ec8abe260350a220afc3e63c6152a1a26 100644 (file)
@@ -54,5 +54,7 @@
        <classpathentry kind="lib" path="crawler/kiss/lib/external/mail.jar"/>
        <classpathentry kind="lib" path="crawler/kiss/lib/external/xerces-2.4.0.jar"/>
        <classpathentry kind="lib" path="crawler/kiss/lib/external/commons-email-1.0.jar"/>
+       <classpathentry kind="lib" path="support/lib/test/emma_ant-2.0.5312.jar"/>
+       <classpathentry kind="lib" path="support/lib/test/emma-2.0.5312.jar"/>
        <classpathentry kind="output" path="support/testbin"/>
 </classpath>
index eef88a27911cc9fc6ca6d9538e01ddb1563c95b6..08e5a2aa4f220336afd2b79b4163d1325d614ceb 100644 (file)
@@ -27,9 +27,6 @@ import org.jmock.cglib.MockObjectTestCase;
  */
 public class ObservableTest extends MockObjectTestCase {
 
-    /**
-     * 
-     */
     private static final int SUBSCRIBER_COUNT = 100;
 
     private static final String UPDATE = "send";
@@ -116,4 +113,25 @@ public class ObservableTest extends MockObjectTestCase {
         _observable.send(message);
     }
 
+    /**
+     * Subscribes and then unsubscribes with a wrong id. Verifies that
+     * IllegalArgumentException is thrown.
+     * 
+     */
+    public void testUnsubscribeWithWrongSubscription() {
+        Mock mockObserver = mock(Observer.class);
+        Observer<ObservableTest, String> observer = (Observer<ObservableTest, String>) mockObserver
+                .proxy();
+        long subscription = _observable.subscribe(observer);
+
+        assertEquals(1, _observable.getObserverCount());
+
+        try {
+            _observable.unsubscribe(subscription + 1);
+        } catch (IllegalArgumentException e) {
+            return; // ok
+        }
+        fail();
+    }
+
 }