Skip to content

Commit 7773ddf

Browse files
Merge pull request ReactiveX#1406 from MarioAriasC/master
Kotlin M8
2 parents ad35778 + 8bce182 commit 7773ddf

File tree

3 files changed

+31
-35
lines changed

3 files changed

+31
-35
lines changed

language-adaptors/rxjava-kotlin/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
}
55

66
dependencies {
7-
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:0.7.270'
7+
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:0.8.11'
88
}
99
}
1010

@@ -13,7 +13,7 @@ apply plugin: 'osgi'
1313

1414
dependencies {
1515
compile project(':rxjava-core')
16-
compile 'org.jetbrains.kotlin:kotlin-stdlib:0.7.270'
16+
compile 'org.jetbrains.kotlin:kotlin-stdlib:0.8.11'
1717
provided 'junit:junit-dep:4.10'
1818
provided 'org.mockito:mockito-core:1.8.5'
1919
}

language-adaptors/rxjava-kotlin/src/test/kotlin/rx/lang/kotlin/BasicKotlinTests.kt

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,11 @@ package rx.lang.kotlin
1818

1919
import rx.Observable
2020
import org.junit.Test
21-
import rx.subscriptions.Subscriptions
2221
import org.mockito.Mockito.*
2322
import org.mockito.Matchers.*
24-
import rx.Observer
2523
import org.junit.Assert.*
2624
import rx.Notification
27-
import rx.Subscription
2825
import kotlin.concurrent.thread
29-
import rx.Observable.OnSubscribeFunc
3026
import rx.lang.kotlin.BasicKotlinTests.AsyncObservable
3127
import rx.Observable.OnSubscribe
3228
import rx.Subscriber
@@ -62,12 +58,12 @@ public class BasicKotlinTests : KotlinTests() {
6258

6359
[Test]
6460
public fun testLast() {
65-
assertEquals("three", Observable.from(listOf("one", "two", "three"))!!.toBlockingObservable()!!.last())
61+
assertEquals("three", Observable.from(listOf("one", "two", "three"))!!.toBlocking()!!.last())
6662
}
6763

6864
[Test]
6965
public fun testLastWithPredicate() {
70-
assertEquals("two", Observable.from(listOf("one", "two", "three"))!!.toBlockingObservable()!!.last { x -> x!!.length == 3 })
66+
assertEquals("two", Observable.from(listOf("one", "two", "three"))!!.toBlocking()!!.last { x -> x!!.length == 3 })
7167
}
7268

7369
[Test]
@@ -150,21 +146,21 @@ public class BasicKotlinTests : KotlinTests() {
150146
[Test]
151147
public fun testFromWithIterable() {
152148
val list = listOf(1, 2, 3, 4, 5)
153-
assertEquals(5, Observable.from(list)!!.count()!!.toBlockingObservable()!!.single())
149+
assertEquals(5, Observable.from(list)!!.count()!!.toBlocking()!!.single())
154150
}
155151

156152
[Test]
157153
public fun testFromWithObjects() {
158154
val list = listOf(1, 2, 3, 4, 5)
159-
assertEquals(2, Observable.from(listOf(list, 6))!!.count()!!.toBlockingObservable()!!.single())
155+
assertEquals(2, Observable.from(listOf(list, 6))!!.count()!!.toBlocking()!!.single())
160156
}
161157

162158
[Test]
163159
public fun testStartWith() {
164160
val list = listOf(10, 11, 12, 13, 14)
165161
val startList = listOf(1, 2, 3, 4, 5)
166-
assertEquals(6, Observable.from(list)!!.startWith(0)!!.count()!!.toBlockingObservable()!!.single())
167-
assertEquals(10, Observable.from(list)!!.startWith(startList)!!.count()!!.toBlockingObservable()!!.single())
162+
assertEquals(6, Observable.from(list)!!.startWith(0)!!.count()!!.toBlocking()!!.single())
163+
assertEquals(10, Observable.from(list)!!.startWith(startList)!!.count()!!.toBlocking()!!.single())
168164
}
169165

170166
[Test]
@@ -227,28 +223,28 @@ public class BasicKotlinTests : KotlinTests() {
227223

228224
[Test]
229225
public fun testForEach() {
230-
Observable.create(AsyncObservable())!!.toBlockingObservable()!!.forEach(received())
226+
Observable.create(AsyncObservable())!!.toBlocking()!!.forEach(received())
231227
verify(a, times(1))!!.received(1)
232228
verify(a, times(1))!!.received(2)
233229
verify(a, times(1))!!.received(3)
234230
}
235231

236232
[Test(expected = javaClass<RuntimeException>())]
237233
public fun testForEachWithError() {
238-
Observable.create(AsyncObservable())!!.toBlockingObservable()!!.forEach { throw RuntimeException("err") }
234+
Observable.create(AsyncObservable())!!.toBlocking()!!.forEach { throw RuntimeException("err") }
239235
fail("we expect an exception to be thrown")
240236
}
241237

242238
[Test]
243239
public fun testLastOrDefault() {
244-
assertEquals("two", Observable.from(listOf("one", "two"))!!.toBlockingObservable()!!.lastOrDefault("default") { x -> x!!.length == 3 })
245-
assertEquals("default", Observable.from(listOf("one", "two"))!!.toBlockingObservable()!!.lastOrDefault("default") { x -> x!!.length > 3 })
240+
assertEquals("two", Observable.from(listOf("one", "two"))!!.toBlocking()!!.lastOrDefault("default") { x -> x!!.length == 3 })
241+
assertEquals("default", Observable.from(listOf("one", "two"))!!.toBlocking()!!.lastOrDefault("default") { x -> x!!.length > 3 })
246242
}
247243

248244
[Test(expected = javaClass<IllegalArgumentException>())]
249245
public fun testSingle() {
250-
assertEquals("one", Observable.from("one")!!.toBlockingObservable()!!.single { x -> x!!.length == 3 })
251-
Observable.from(listOf("one", "two"))!!.toBlockingObservable()!!.single { x -> x!!.length == 3 }
246+
assertEquals("one", Observable.from("one")!!.toBlocking()!!.single { x -> x!!.length == 3 })
247+
Observable.from(listOf("one", "two"))!!.toBlocking()!!.single { x -> x!!.length == 3 }
252248
fail()
253249
}
254250

@@ -271,7 +267,7 @@ public class BasicKotlinTests : KotlinTests() {
271267
val o2 = Observable.from(listOf(4, 5, 6))!!
272268
val o3 = Observable.from(listOf(7, 8, 9))!!
273269

274-
val values = Observable.zip(o1, o2, o3) { a, b, c -> listOf(a, b, c) }!!.toList()!!.toBlockingObservable()!!.single()!!
270+
val values = Observable.zip(o1, o2, o3) { a, b, c -> listOf(a, b, c) }!!.toList()!!.toBlocking()!!.single()!!
275271
assertEquals(listOf(1, 4, 7), values[0])
276272
assertEquals(listOf(2, 5, 8), values[1])
277273
assertEquals(listOf(3, 6, 9), values[2])
@@ -283,7 +279,7 @@ public class BasicKotlinTests : KotlinTests() {
283279
val o2 = Observable.from(listOf(4, 5, 6))!!
284280
val o3 = Observable.from(listOf(7, 8, 9))!!
285281

286-
val values = Observable.zip(listOf(o1, o2, o3)) { args -> listOf(*args) }!!.toList()!!.toBlockingObservable()!!.single()!!
282+
val values = Observable.zip(listOf(o1, o2, o3)) { args -> listOf(*args) }!!.toList()!!.toBlocking()!!.single()!!
287283
assertEquals(listOf(1, 4, 7), values[0])
288284
assertEquals(listOf(2, 5, 8), values[1])
289285
assertEquals(listOf(3, 6, 9), values[2])
@@ -296,10 +292,10 @@ public class BasicKotlinTests : KotlinTests() {
296292
Observable.from(listOf("one", "two", "three", "four", "five", "six"))!!
297293
.groupBy { s -> s!!.length }!!
298294
.flatMap { groupObervable ->
299-
groupObervable!!.map { s ->
300-
"Value: $s Group ${groupObervable.getKey()}"
301-
}
302-
}!!.toBlockingObservable()!!.forEach { s ->
295+
groupObervable!!.map { s ->
296+
"Value: $s Group ${groupObervable.getKey()}"
297+
}
298+
}!!.toBlocking()!!.forEach { s ->
303299
println(s)
304300
count++
305301
}
@@ -343,7 +339,7 @@ public class BasicKotlinTests : KotlinTests() {
343339
}
344340

345341
class TestOnSubscribe(val count: Int) : OnSubscribe<String> {
346-
override fun call(op: Subscriber<in String>?) {
342+
override fun call(op: Subscriber<in String>?) {
347343
op!!.onNext("hello_$count")
348344
op.onCompleted()
349345
}

language-adaptors/rxjava-kotlin/src/test/kotlin/rx/lang/kotlin/ExtensionTests.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ public class ExtensionTests : KotlinTests() {
5555

5656
[Test]
5757
public fun testLast() {
58-
assertEquals("three", listOf("one", "two", "three").asObservable().toBlockingObservable()!!.last())
58+
assertEquals("three", listOf("one", "two", "three").asObservable().toBlocking()!!.last())
5959
}
6060

6161
[Test]
6262
public fun testLastWithPredicate() {
63-
assertEquals("two", listOf("one", "two", "three").asObservable().toBlockingObservable()!!.last { x -> x!!.length == 3 })
63+
assertEquals("two", listOf("one", "two", "three").asObservable().toBlocking()!!.last { x -> x!!.length == 3 })
6464
}
6565

6666
[Test]
@@ -139,15 +139,15 @@ public class ExtensionTests : KotlinTests() {
139139

140140
[Test]
141141
public fun testFromWithIterable() {
142-
assertEquals(5, listOf(1, 2, 3, 4, 5).asObservable().count()!!.toBlockingObservable()!!.single())
142+
assertEquals(5, listOf(1, 2, 3, 4, 5).asObservable().count()!!.toBlocking()!!.single())
143143
}
144144

145145
[Test]
146146
public fun testStartWith() {
147147
val list = listOf(10, 11, 12, 13, 14)
148148
val startList = listOf(1, 2, 3, 4, 5)
149-
assertEquals(6, list.asObservable().startWith(0)!!.count()!!.toBlockingObservable()!!.single())
150-
assertEquals(10, list.asObservable().startWith(startList)!!.count()!!.toBlockingObservable()!!.single())
149+
assertEquals(6, list.asObservable().startWith(0)!!.count()!!.toBlocking()!!.single())
150+
assertEquals(10, list.asObservable().startWith(startList)!!.count()!!.toBlocking()!!.single())
151151
}
152152

153153
[Test]
@@ -210,22 +210,22 @@ public class ExtensionTests : KotlinTests() {
210210

211211
[Test]
212212
public fun testForEach() {
213-
asyncObservable.asObservable().toBlockingObservable()!!.forEach(received())
213+
asyncObservable.asObservable().toBlocking()!!.forEach(received())
214214
verify(a, times(1))!!.received(1)
215215
verify(a, times(1))!!.received(2)
216216
verify(a, times(1))!!.received(3)
217217
}
218218

219219
[Test(expected = javaClass<RuntimeException>())]
220220
public fun testForEachWithError() {
221-
asyncObservable.asObservable().toBlockingObservable()!!.forEach { throw RuntimeException("err") }
221+
asyncObservable.asObservable().toBlocking()!!.forEach { throw RuntimeException("err") }
222222
fail("we expect an exception to be thrown")
223223
}
224224

225225
[Test]
226226
public fun testLastOrDefault() {
227-
assertEquals("two", ("one" to"two").asObservable().toBlockingObservable()!!.lastOrDefault("default") { x -> x!!.length == 3 })
228-
assertEquals("default", ("one" to"two").asObservable().toBlockingObservable()!!.lastOrDefault("default") { x -> x!!.length > 3 })
227+
assertEquals("two", ("one" to"two").asObservable().toBlocking()!!.lastOrDefault("default") { x -> x!!.length == 3 })
228+
assertEquals("default", ("one" to"two").asObservable().toBlocking()!!.lastOrDefault("default") { x -> x!!.length > 3 })
229229
}
230230

231231
[Test]
@@ -247,7 +247,7 @@ public class ExtensionTests : KotlinTests() {
247247
val o2 = Triple(4, 5, 6).asObservable()
248248
val o3 = Triple(7, 8, 9).asObservable()
249249

250-
val values = Observable.zip(o1, o2, o3) { a, b, c -> listOf(a, b, c) }!!.toList()!!.toBlockingObservable()!!.single()!!
250+
val values = Observable.zip(o1, o2, o3) { a, b, c -> listOf(a, b, c) }!!.toList()!!.toBlocking()!!.single()!!
251251
assertEquals(listOf(1, 4, 7), values[0])
252252
assertEquals(listOf(2, 5, 8), values[1])
253253
assertEquals(listOf(3, 6, 9), values[2])

0 commit comments

Comments
 (0)