<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>
*/
public class ObservableTest extends MockObjectTestCase {
- /**
- *
- */
private static final int SUBSCRIBER_COUNT = 100;
private static final String UPDATE = "send";
_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();
+ }
+
}