Skip to content

Commit 96feb27

Browse files
Merge pull request #361 from benjchristensen/issue-359-varargs
Fix vararg issues reported in #359
2 parents ccc10cf + af31156 commit 96feb27

File tree

14 files changed

+1556
-131
lines changed

14 files changed

+1556
-131
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)});

language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/RxImplicitsTests.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class UnitTestSuite extends JUnitSuite {
7575
}
7676

7777
@Test def testSingleOrDefault {
78-
assertEquals(0, Observable.from[Int]().toBlockingObservable.singleOrDefault(0))
78+
assertEquals(0, Observable.empty[Int]().toBlockingObservable.singleOrDefault(0))
7979
assertEquals(1, Observable.from(1).toBlockingObservable.singleOrDefault(0))
8080
try {
8181
Observable.from(1, 2, 3).toBlockingObservable.singleOrDefault(0)
@@ -135,8 +135,7 @@ class UnitTestSuite extends JUnitSuite {
135135
@Test def testMerge {
136136
val observable1 = Observable.from(1, 2, 3)
137137
val observable2 = Observable.from(4, 5, 6)
138-
val observableList = List(observable1, observable2).asJava
139-
val merged = Observable.merge(observableList)
138+
val merged = Observable.merge(observable1, observable2)
140139
assertSubscribeReceives(merged)(1, 2, 3, 4, 5, 6)
141140
}
142141

@@ -232,13 +231,13 @@ class UnitTestSuite extends JUnitSuite {
232231
@Test def testLastOrDefault {
233232
val observable = Observable.from(1, 2, 3, 4)
234233
assertEquals(4, observable.toBlockingObservable.lastOrDefault(5))
235-
assertEquals(5, Observable.from[Int]().toBlockingObservable.lastOrDefault(5))
234+
assertEquals(5, Observable.empty[Int]().toBlockingObservable.lastOrDefault(5))
236235
}
237236

238237
@Test def testLastOrDefaultPredicate {
239238
val observable = Observable.from(1, 2, 3, 4)
240239
assertEquals(3, observable.toBlockingObservable.lastOrDefault(5, isOdd))
241-
assertEquals(5, Observable.from[Int]().toBlockingObservable.lastOrDefault(5, isOdd))
240+
assertEquals(5, Observable.empty[Int]().toBlockingObservable.lastOrDefault(5, isOdd))
242241
}
243242

244243
@Test def testMap {

0 commit comments

Comments
 (0)