From 2199803fbf260ee1339aff89a033dacf64d03efd Mon Sep 17 00:00:00 2001 From: erik Date: Sun, 26 Mar 2006 20:15:33 +0000 Subject: [PATCH] updated testcase --- .classpath | 2 ++ .../org/wamblee/observer/ObservableTest.java | 24 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.classpath b/.classpath index 1cec05af..4c7b227e 100644 --- a/.classpath +++ b/.classpath @@ -54,5 +54,7 @@ + + diff --git a/support/test/org/wamblee/observer/ObservableTest.java b/support/test/org/wamblee/observer/ObservableTest.java index eef88a27..08e5a2aa 100644 --- a/support/test/org/wamblee/observer/ObservableTest.java +++ b/support/test/org/wamblee/observer/ObservableTest.java @@ -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 observer = (Observer) mockObserver + .proxy(); + long subscription = _observable.subscribe(observer); + + assertEquals(1, _observable.getObserverCount()); + + try { + _observable.unsubscribe(subscription + 1); + } catch (IllegalArgumentException e) { + return; // ok + } + fail(); + } + } -- 2.31.1