From bdddee691ce79a8c1d79b99c01e261611dc3025f Mon Sep 17 00:00:00 2001 From: zsxwing Date: Thu, 26 Sep 2013 16:59:54 +0800 Subject: [PATCH] Add one more unit test --- rxjava-core/src/test/java/rx/ObservableTests.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rxjava-core/src/test/java/rx/ObservableTests.java b/rxjava-core/src/test/java/rx/ObservableTests.java index 1710f16d18..3919ab6c9d 100644 --- a/rxjava-core/src/test/java/rx/ObservableTests.java +++ b/rxjava-core/src/test/java/rx/ObservableTests.java @@ -755,6 +755,20 @@ public void testContains() { verify(aObserver, times(1)).onCompleted(); } + @Test + public void testContainsWithInexistence() { + Observable observable = Observable.from("a", "b", null).contains("c"); + + @SuppressWarnings("unchecked") + Observer aObserver = mock(Observer.class); + observable.subscribe(aObserver); + verify(aObserver, times(1)).onNext(false); + verify(aObserver, never()).onNext(true); + verify(aObserver, never()).onError( + org.mockito.Matchers.any(Throwable.class)); + verify(aObserver, times(1)).onCompleted(); + } + @Test public void testContainsWithNull() { Observable observable = Observable.from("a", "b", null).contains(null);