Skip to content

Commit 8926255

Browse files
Clarify intent of unit test
1 parent 4e4c165 commit 8926255

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

rxjava-core/src/test/java/rx/operators/OperationTimeoutTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public Observable<Integer> call() {
7373
}
7474

7575
@Test
76-
public void testTimeoutSelectorTimeoutFirst() {
77-
PublishSubject<Integer> source = PublishSubject.create();
76+
public void testTimeoutSelectorTimeoutFirst() throws InterruptedException {
77+
Observable<Integer> source = Observable.<Integer>never();
7878
final PublishSubject<Integer> timeout = PublishSubject.create();
7979

8080
Func1<Integer, Observable<Integer>> timeoutFunc = new Func1<Integer, Observable<Integer>>() {
@@ -97,10 +97,10 @@ public Observable<Integer> call() {
9797
Observer<Object> o = mock(Observer.class);
9898
InOrder inOrder = inOrder(o);
9999

100-
source.toObservable().timeout(firstTimeoutFunc, timeoutFunc, other).subscribe(new TestObserver<Object>(o));
101-
100+
source.timeout(firstTimeoutFunc, timeoutFunc, other).subscribe(new TestObserver<Object>(o));
101+
102102
timeout.onNext(1);
103-
103+
104104
inOrder.verify(o).onNext(100);
105105
inOrder.verify(o).onCompleted();
106106
verify(o, never()).onError(any(Throwable.class));
@@ -109,7 +109,7 @@ public Observable<Integer> call() {
109109

110110
@Test
111111
public void testTimeoutSelectorFirstThrows() {
112-
PublishSubject<Integer> source = PublishSubject.create();
112+
Observable<Integer> source = Observable.<Integer>never();
113113
final PublishSubject<Integer> timeout = PublishSubject.create();
114114

115115
Func1<Integer, Observable<Integer>> timeoutFunc = new Func1<Integer, Observable<Integer>>() {
@@ -131,7 +131,7 @@ public Observable<Integer> call() {
131131
@SuppressWarnings("unchecked")
132132
Observer<Object> o = mock(Observer.class);
133133

134-
source.toObservable().timeout(firstTimeoutFunc, timeoutFunc, other).subscribe(new TestObserver<Object>(o));
134+
source.timeout(firstTimeoutFunc, timeoutFunc, other).subscribe(new TestObserver<Object>(o));
135135

136136
verify(o).onError(any(OperationReduceTest.CustomException.class));
137137
verify(o, never()).onNext(any());

0 commit comments

Comments
 (0)