Skip to content

Commit 98584ec

Browse files
committed
[WIP] Experiment with Kotlin 1.3 and coroutines
1 parent a67fb80 commit 98584ec

File tree

6 files changed

+22
-21
lines changed

6 files changed

+22
-21
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ matrix:
1010
env: TERM=dumb MOCK_MAKER=mock-maker-inline KOTLIN_VERSION=1.1.61
1111
- jdk: oraclejdk8
1212
env: TERM=dumb MOCK_MAKER=mock-maker-inline KOTLIN_VERSION=1.2.50
13+
- jdk: oraclejdk8
14+
env: TERM=dumb MOCK_MAKER=mock-maker-inline KOTLIN_VERSION=1.3.0-rc-116
1315
- jdk: oraclejdk8
1416
env: TERM=dumb KOTLIN_VERSION=1.0.7
1517
- jdk: oraclejdk8
1618
env: TERM=dumb KOTLIN_VERSION=1.1.61
1719
- jdk: oraclejdk8
1820
env: TERM=dumb KOTLIN_VERSION=1.2.50
21+
- jdk: oraclejdk8
22+
env: TERM=dumb KOTLIN_VERSION=1.3.0-rc-116
1923

2024

2125
env:

mockito-kotlin/build.gradle

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ apply from: '../publishing.gradle'
33
apply plugin: 'org.jetbrains.dokka'
44

55
buildscript {
6-
ext.kotlin_version = "1.2.50"
6+
ext.kotlin_version = "1.3.0-rc-116"
77

88
repositories {
99
mavenCentral()
1010
jcenter()
11+
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap' }
1112
}
1213

1314
dependencies {
@@ -21,21 +22,22 @@ buildscript {
2122
repositories {
2223
mavenCentral()
2324
jcenter()
25+
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap' }
2426
}
2527

2628
dependencies {
2729
compileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
28-
compileOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.23.3'
30+
compileOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.30.0-eap13'
2931

3032
compile "org.mockito:mockito-core:2.21.0"
3133

3234
testCompile 'junit:junit:4.12'
3335
testCompile 'com.nhaarman:expect.kt:1.0.0'
3436

3537
testCompile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
36-
testCompile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.23.3'
38+
testCompile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.30.0-eap13'
3739

38-
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:0.23.3"
40+
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:0.30.0-eap13"
3941
}
4042

4143
dokka {
@@ -49,10 +51,3 @@ dokka {
4951
}
5052
}
5153
javadoc.dependsOn dokka
52-
53-
54-
kotlin {
55-
experimental {
56-
coroutines "enable"
57-
}
58-
}

mockito-kotlin/src/main/kotlin/com/nhaarman/mockitokotlin2/KStubbing.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
package com.nhaarman.mockitokotlin2
2727

2828
import com.nhaarman.mockitokotlin2.internal.createInstance
29-
import kotlinx.coroutines.experimental.runBlocking
29+
import kotlinx.coroutines.runBlocking
3030
import org.mockito.Mockito
3131
import org.mockito.stubbing.OngoingStubbing
3232
import kotlin.reflect.KClass

mockito-kotlin/src/main/kotlin/com/nhaarman/mockitokotlin2/Verification.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
package com.nhaarman.mockitokotlin2
2727

2828
import com.nhaarman.mockitokotlin2.internal.createInstance
29-
import kotlinx.coroutines.experimental.runBlocking
29+
import kotlinx.coroutines.runBlocking
3030
import org.mockito.InOrder
3131
import org.mockito.Mockito
3232
import org.mockito.verification.VerificationAfterDelay

mockito-kotlin/src/test/kotlin/test/CoroutinesTest.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ package test
44

55
import com.nhaarman.expect.expect
66
import com.nhaarman.mockitokotlin2.*
7-
import kotlinx.coroutines.experimental.CommonPool
8-
import kotlinx.coroutines.experimental.delay
9-
import kotlinx.coroutines.experimental.runBlocking
10-
import kotlinx.coroutines.experimental.withContext
7+
import kotlinx.coroutines.Dispatchers
8+
import kotlinx.coroutines.delay
9+
import kotlinx.coroutines.runBlocking
10+
import kotlinx.coroutines.withContext
1111
import org.junit.Test
1212

1313

@@ -139,7 +139,7 @@ class CoroutinesTest {
139139

140140
@Test
141141
fun verifySuspendMethod() = runBlocking {
142-
val testSubject : SomeInterface = mock()
142+
val testSubject: SomeInterface = mock()
143143

144144
testSubject.suspending()
145145

@@ -157,9 +157,9 @@ interface SomeInterface {
157157

158158
class SomeClass {
159159

160-
suspend fun result(r: Int) = withContext(CommonPool) { r }
160+
suspend fun result(r: Int) = withContext(Dispatchers.Default) { r }
161161

162-
suspend fun delaying() = withContext(CommonPool) {
162+
suspend fun delaying() = withContext(Dispatchers.Default) {
163163
delay(100)
164164
42
165165
}

tests/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
buildscript {
2-
ext.kotlin_version = '1.2.50'
32
ext.kotlin_version = System.getenv("KOTLIN_VERSION") ?: '1.0.7'
3+
ext.kotlin_version = '1.3.0-rc-116'
44

55
repositories {
66
mavenCentral()
7+
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap' }
78
}
89
dependencies {
910
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
@@ -16,6 +17,7 @@ apply plugin: 'kotlin'
1617
repositories {
1718
mavenCentral()
1819
jcenter()
20+
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap' }
1921
}
2022

2123
dependencies {

0 commit comments

Comments
 (0)