Skip to content

Commit 916f186

Browse files
authored
Merge pull request #179 from nhaarman/release-1.5.0
Release 1.5.0
2 parents e0c1475 + 9df5996 commit 916f186

File tree

9 files changed

+82
-12
lines changed

9 files changed

+82
-12
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ language: java
44

55
matrix:
66
include:
7-
- jdk: oraclejdk7
7+
- jdk: oraclejdk8
88
env: TERM=dumb MOCK_MAKER=mock-maker-inline KOTLIN_VERSION=1.0.7
9-
- jdk: oraclejdk7
10-
env: TERM=dumb MOCK_MAKER=mock-maker-inline KOTLIN_VERSION=1.1.1
9+
- jdk: oraclejdk8
10+
env: TERM=dumb MOCK_MAKER=mock-maker-inline KOTLIN_VERSION=1.1.2-4
1111
- jdk: oraclejdk8
1212
env: TERM=dumb KOTLIN_VERSION=1.0.7
1313
- jdk: oraclejdk8
14-
env: TERM=dumb KOTLIN_VERSION=1.1.1
14+
env: TERM=dumb KOTLIN_VERSION=1.1.2-4
1515

1616

1717
env:

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ For Gradle users, add the following to your `build.gradle`, replacing `x.x.x` wi
1212
testCompile "com.nhaarman:mockito-kotlin:x.x.x"
1313
```
1414

15+
If you use Kotlin 1.1, you can instead depend on the `mockito-kotlin-kt1.1` artifact.
16+
17+
```groovy
18+
testCompile "com.nhaarman:mockito-kotlin-kt1.1:x.x.x"
19+
```
20+
1521
## Example
1622

1723
A test using Mockito-Kotlin typically looks like the following:

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'com.github.ben-manes.versions' version '0.14.0'
2+
id 'com.github.ben-manes.versions' version '0.15.0'
33
}
44

55
apply from: 'gradle/scripts/tagging.gradle'

mockito-kotlin-kt1.1/build.gradle

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
apply plugin: 'kotlin'
2+
apply from: '../publishing.gradle'
3+
apply plugin: 'org.jetbrains.dokka'
4+
5+
buildscript {
6+
ext.kotlin_version = '1.1.2-4'
7+
8+
repositories {
9+
mavenCentral()
10+
jcenter()
11+
}
12+
13+
dependencies {
14+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15+
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.14"
16+
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3"
17+
classpath "com.github.dcendents:android-maven-gradle-plugin:1.5"
18+
}
19+
}
20+
21+
repositories {
22+
mavenCentral()
23+
jcenter()
24+
}
25+
26+
dependencies {
27+
compile project(':mockito-kotlin')
28+
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
29+
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
30+
}
31+
32+
dokka {
33+
outputFormat = 'html'
34+
outputDirectory = "$buildDir/javadoc"
35+
36+
linkMapping {
37+
dir = "src/main/kotlin"
38+
url = "https://github.com/nhaarman/mockito-kotlin/tree/master/mockito-kotlin/src/main/kotlin"
39+
suffix = "#L"
40+
}
41+
}
42+
javadoc.dependsOn dokka

mockito-kotlin/build.gradle

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

55
buildscript {
@@ -8,12 +8,11 @@ buildscript {
88
repositories {
99
mavenCentral()
1010
jcenter()
11-
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' }
1211
}
1312

1413
dependencies {
1514
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
16-
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.13"
15+
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.14"
1716
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3"
1817
classpath "com.github.dcendents:android-maven-gradle-plugin:1.5"
1918
}
@@ -22,13 +21,12 @@ buildscript {
2221
repositories {
2322
mavenCentral()
2423
jcenter()
25-
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' }
2624
}
2725

2826
dependencies {
2927
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
3028
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
31-
compile "org.mockito:mockito-core:2.7.21"
29+
compile "org.mockito:mockito-core:2.8.9"
3230

3331
/* Tests */
3432
testCompile "junit:junit:4.12"

mockito-kotlin/src/main/kotlin/com/nhaarman/mockito_kotlin/Mockito.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ fun <T> refEq(value: T, vararg excludeFields: String): T? = Mockito.refEq(value,
236236

237237
fun <T> reset(vararg mocks: T) = Mockito.reset(*mocks)
238238

239-
fun <T> same(value: T): T? = Mockito.same(value) ?: value
239+
fun <T> same(value: T): T = Mockito.same(value) ?: value
240240

241241
inline fun <reified T : Any> spy(): T = Mockito.spy(T::class.java)!!
242242
fun <T> spy(value: T): T = Mockito.spy(value)!!

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,4 +983,28 @@ class MockitoTest : TestBase() {
983983
verify(this).nullableString(isA<String>())
984984
}
985985
}
986+
987+
@Test
988+
fun same_withNonNullArgument() {
989+
mock<Methods>().apply {
990+
string("")
991+
verify(this).string(same(""))
992+
}
993+
}
994+
995+
@Test
996+
fun same_withNullableNonNullArgument() {
997+
mock<Methods>().apply {
998+
nullableString("")
999+
verify(this).nullableString(same(""))
1000+
}
1001+
}
1002+
1003+
@Test
1004+
fun same_withNullArgument() {
1005+
mock<Methods>().apply {
1006+
nullableString(null)
1007+
verify(this).nullableString(same(null))
1008+
}
1009+
}
9861010
}
File renamed without changes.

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
include 'mockito-kotlin'
2-
2+
include 'mockito-kotlin-kt1.1'

0 commit comments

Comments
 (0)