From: Erik Brakkee Date: Sun, 26 Mar 2006 20:15:33 +0000 (+0000) Subject: updated testcase X-Git-Tag: wamblee-utils-0.7~1069 X-Git-Url: http://wamblee.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=214beff6d03ee7a3c9e4b22884357938238fdb76;p=utils updated testcase --- 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(); + } + }