Skip to content

Commit 077b148

Browse files
Fix RxJava Groovy Unit Tests after static method refactor
1 parent 8cb026a commit 077b148

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

language-adaptors/rxjava-groovy/src/test/groovy/rx/lang/groovy/ObservableTests.groovy

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def class ObservableTests {
5858

5959
@Test
6060
public void testFilter() {
61-
Observable.filter(Observable.from(1, 2, 3), {it >= 2}).subscribe({ result -> a.received(result)});
61+
Observable.from(1, 2, 3).filter({it >= 2}).subscribe({ result -> a.received(result)});
6262
verify(a, times(0)).received(1);
6363
verify(a, times(1)).received(2);
6464
verify(a, times(1)).received(3);
@@ -82,15 +82,15 @@ def class ObservableTests {
8282

8383
@Test
8484
public void testMap2() {
85-
Observable.map(Observable.from(1, 2, 3), {'hello_' + it}).subscribe({ result -> a.received(result)});
85+
Observable.from(1, 2, 3).map({'hello_' + it}).subscribe({ result -> a.received(result)});
8686
verify(a, times(1)).received("hello_" + 1);
8787
verify(a, times(1)).received("hello_" + 2);
8888
verify(a, times(1)).received("hello_" + 3);
8989
}
9090

9191
@Test
9292
public void testMaterialize() {
93-
Observable.materialize(Observable.from(1, 2, 3)).subscribe({ result -> a.received(result)});
93+
Observable.from(1, 2, 3).materialize().subscribe({ result -> a.received(result)});
9494
// we expect 4 onNext calls: 3 for 1, 2, 3 ObservableNotification.OnNext and 1 for ObservableNotification.OnCompleted
9595
verify(a, times(4)).received(any(Notification.class));
9696
verify(a, times(0)).error(any(Exception.class));
@@ -162,23 +162,23 @@ def class ObservableTests {
162162

163163
@Test
164164
public void testSkipTake() {
165-
Observable.skip(Observable.from(1, 2, 3), 1).take(1).subscribe({ result -> a.received(result)});
165+
Observable.from(1, 2, 3).skip(1).take(1).subscribe({ result -> a.received(result)});
166166
verify(a, times(0)).received(1);
167167
verify(a, times(1)).received(2);
168168
verify(a, times(0)).received(3);
169169
}
170170

171171
@Test
172172
public void testSkip() {
173-
Observable.skip(Observable.from(1, 2, 3), 2).subscribe({ result -> a.received(result)});
173+
Observable.from(1, 2, 3).skip(2).subscribe({ result -> a.received(result)});
174174
verify(a, times(0)).received(1);
175175
verify(a, times(0)).received(2);
176176
verify(a, times(1)).received(3);
177177
}
178178

179179
@Test
180180
public void testTake() {
181-
Observable.take(Observable.from(1, 2, 3), 2).subscribe({ result -> a.received(result)});
181+
Observable.from(1, 2, 3).take(2).subscribe({ result -> a.received(result)});
182182
verify(a, times(1)).received(1);
183183
verify(a, times(1)).received(2);
184184
verify(a, times(0)).received(3);
@@ -192,15 +192,15 @@ def class ObservableTests {
192192

193193
@Test
194194
public void testTakeWhileViaGroovy() {
195-
Observable.takeWhile(Observable.from(1, 2, 3), { x -> x < 3}).subscribe({ result -> a.received(result)});
195+
Observable.from(1, 2, 3).takeWhile( { x -> x < 3}).subscribe({ result -> a.received(result)});
196196
verify(a, times(1)).received(1);
197197
verify(a, times(1)).received(2);
198198
verify(a, times(0)).received(3);
199199
}
200200

201201
@Test
202202
public void testTakeWhileWithIndexViaGroovy() {
203-
Observable.takeWhileWithIndex(Observable.from(1, 2, 3), { x, i -> i < 2}).subscribe({ result -> a.received(result)});
203+
Observable.from(1, 2, 3).takeWhileWithIndex({ x, i -> i < 2}).subscribe({ result -> a.received(result)});
204204
verify(a, times(1)).received(1);
205205
verify(a, times(1)).received(2);
206206
verify(a, times(0)).received(3);
@@ -212,24 +212,12 @@ def class ObservableTests {
212212
verify(a, times(1)).received(Arrays.asList(1, 2, 3, 4, 5));
213213
}
214214

215-
@Test
216-
public void testToSortedListStatic() {
217-
Observable.toSortedList(Observable.from(1, 3, 2, 5, 4)).subscribe({ result -> a.received(result)});
218-
verify(a, times(1)).received(Arrays.asList(1, 2, 3, 4, 5));
219-
}
220-
221215
@Test
222216
public void testToSortedListWithFunction() {
223217
new TestFactory().getNumbers().toSortedList({a, b -> a - b}).subscribe({ result -> a.received(result)});
224218
verify(a, times(1)).received(Arrays.asList(1, 2, 3, 4, 5));
225219
}
226220

227-
@Test
228-
public void testToSortedListWithFunctionStatic() {
229-
Observable.toSortedList(Observable.from(1, 3, 2, 5, 4), {a, b -> a - b}).subscribe({ result -> a.received(result)});
230-
verify(a, times(1)).received(Arrays.asList(1, 2, 3, 4, 5));
231-
}
232-
233221
@Test
234222
public void testForEach() {
235223
Observable.create(new AsyncObservable()).toBlockingObservable().forEach({ result -> a.received(result)});

0 commit comments

Comments
 (0)