Skip to content

Commit af31156

Browse files
Vararg change unit tests in Groovy
1 parent 5957881 commit af31156

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,30 @@ def class ObservableTests {
155155
verify(a, times(1)).received("hello_2");
156156
}
157157

158+
@Test
159+
public void testFromWithIterable() {
160+
def list = [1, 2, 3, 4, 5]
161+
assertEquals(5, Observable.from(list).count().toBlockingObservable().single());
162+
}
163+
164+
@Test
165+
public void testFromWithObjects() {
166+
def list = [1, 2, 3, 4, 5]
167+
// this should now treat these as 2 objects so have a count of 2
168+
assertEquals(2, Observable.from(list, 6).count().toBlockingObservable().single());
169+
}
170+
171+
/**
172+
* Check that two different single arg methods are selected correctly
173+
*/
174+
@Test
175+
public void testStartWith() {
176+
def list = [10, 11, 12, 13, 14]
177+
def startList = [1, 2, 3, 4, 5]
178+
assertEquals(6, Observable.from(list).startWith(0).count().toBlockingObservable().single());
179+
assertEquals(10, Observable.from(list).startWith(startList).count().toBlockingObservable().single());
180+
}
181+
158182
@Test
159183
public void testScriptWithOnNext() {
160184
new TestFactory().getObservable().subscribe({ result -> a.received(result)});

0 commit comments

Comments
 (0)