21
21
import static org .mockito .Mockito .times ;
22
22
import static org .mockito .Mockito .verify ;
23
23
import static org .mockito .Mockito .when ;
24
- import static rx .operators .OperationUsing .using ;
25
24
26
25
import org .junit .Test ;
27
26
import org .mockito .InOrder ;
35
34
import rx .functions .Func1 ;
36
35
import rx .subscriptions .Subscriptions ;
37
36
38
- public class OperationUsingTest {
37
+ public class OperatorUsingTest {
39
38
40
39
@ SuppressWarnings ("serial" )
41
40
private static class TestException extends RuntimeException {
@@ -69,8 +68,7 @@ public Observable<String> call(Resource resource) {
69
68
70
69
@ SuppressWarnings ("unchecked" )
71
70
Observer <String > observer = (Observer <String >) mock (Observer .class );
72
- Observable <String > observable = Observable .create (using (
73
- resourceFactory , observableFactory ));
71
+ Observable <String > observable = Observable .using (resourceFactory , observableFactory );
74
72
observable .subscribe (observer );
75
73
76
74
InOrder inOrder = inOrder (observer );
@@ -124,8 +122,7 @@ public Observable<String> call(Resource resource) {
124
122
125
123
@ SuppressWarnings ("unchecked" )
126
124
Observer <String > observer = (Observer <String >) mock (Observer .class );
127
- Observable <String > observable = Observable .create (using (
128
- resourceFactory , observableFactory ));
125
+ Observable <String > observable = Observable .using (resourceFactory , observableFactory );
129
126
observable .subscribe (observer );
130
127
observable .subscribe (observer );
131
128
@@ -157,8 +154,7 @@ public Observable<Integer> call(Subscription subscription) {
157
154
}
158
155
};
159
156
160
- Observable .create (using (resourceFactory , observableFactory ))
161
- .toBlockingObservable ().last ();
157
+ Observable .using (resourceFactory , observableFactory ).toBlockingObservable ().last ();
162
158
}
163
159
164
160
@ Test
@@ -179,8 +175,7 @@ public Observable<Integer> call(Subscription subscription) {
179
175
};
180
176
181
177
try {
182
- Observable .create (using (resourceFactory , observableFactory ))
183
- .toBlockingObservable ().last ();
178
+ Observable .using (resourceFactory , observableFactory ).toBlockingObservable ().last ();
184
179
fail ("Should throw a TestException when the observableFactory throws it" );
185
180
} catch (TestException e ) {
186
181
// Make sure that unsubscribe is called so that users can close
@@ -212,8 +207,7 @@ public Subscription onSubscribe(Observer<? super Integer> t1) {
212
207
};
213
208
214
209
try {
215
- Observable .create (using (resourceFactory , observableFactory ))
216
- .toBlockingObservable ().last ();
210
+ Observable .using (resourceFactory , observableFactory ).toBlockingObservable ().last ();
217
211
fail ("Should throw a TestException when the observableFactory throws it" );
218
212
} catch (TestException e ) {
219
213
// Make sure that unsubscribe is called so that users can close
0 commit comments