Skip to content

Commit

Permalink
Merge pull request #179 from nhaarman/release-1.5.0
Browse files Browse the repository at this point in the history
Release 1.5.0
  • Loading branch information
nhaarman authored Jun 3, 2017
2 parents e0c1475 + 9df5996 commit 916f186
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 12 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ language: java

matrix:
include:
- jdk: oraclejdk7
- jdk: oraclejdk8
env: TERM=dumb MOCK_MAKER=mock-maker-inline KOTLIN_VERSION=1.0.7
- jdk: oraclejdk7
env: TERM=dumb MOCK_MAKER=mock-maker-inline KOTLIN_VERSION=1.1.1
- jdk: oraclejdk8
env: TERM=dumb MOCK_MAKER=mock-maker-inline KOTLIN_VERSION=1.1.2-4
- jdk: oraclejdk8
env: TERM=dumb KOTLIN_VERSION=1.0.7
- jdk: oraclejdk8
env: TERM=dumb KOTLIN_VERSION=1.1.1
env: TERM=dumb KOTLIN_VERSION=1.1.2-4


env:
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ For Gradle users, add the following to your `build.gradle`, replacing `x.x.x` wi
testCompile "com.nhaarman:mockito-kotlin:x.x.x"
```

If you use Kotlin 1.1, you can instead depend on the `mockito-kotlin-kt1.1` artifact.

```groovy
testCompile "com.nhaarman:mockito-kotlin-kt1.1:x.x.x"
```

## Example

A test using Mockito-Kotlin typically looks like the following:
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.github.ben-manes.versions' version '0.14.0'
id 'com.github.ben-manes.versions' version '0.15.0'
}

apply from: 'gradle/scripts/tagging.gradle'
Expand Down
42 changes: 42 additions & 0 deletions mockito-kotlin-kt1.1/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apply plugin: 'kotlin'
apply from: '../publishing.gradle'
apply plugin: 'org.jetbrains.dokka'

buildscript {
ext.kotlin_version = '1.1.2-4'

repositories {
mavenCentral()
jcenter()
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.14"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3"
classpath "com.github.dcendents:android-maven-gradle-plugin:1.5"
}
}

repositories {
mavenCentral()
jcenter()
}

dependencies {
compile project(':mockito-kotlin')
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
}

dokka {
outputFormat = 'html'
outputDirectory = "$buildDir/javadoc"

linkMapping {
dir = "src/main/kotlin"
url = "https://github.com/nhaarman/mockito-kotlin/tree/master/mockito-kotlin/src/main/kotlin"
suffix = "#L"
}
}
javadoc.dependsOn dokka
8 changes: 3 additions & 5 deletions mockito-kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'kotlin'
apply from: './publishing.gradle'
apply from: '../publishing.gradle'
apply plugin: 'org.jetbrains.dokka'

buildscript {
Expand All @@ -8,12 +8,11 @@ buildscript {
repositories {
mavenCentral()
jcenter()
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' }
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.13"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.14"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3"
classpath "com.github.dcendents:android-maven-gradle-plugin:1.5"
}
Expand All @@ -22,13 +21,12 @@ buildscript {
repositories {
mavenCentral()
jcenter()
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' }
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "org.mockito:mockito-core:2.7.21"
compile "org.mockito:mockito-core:2.8.9"

/* Tests */
testCompile "junit:junit:4.12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ fun <T> refEq(value: T, vararg excludeFields: String): T? = Mockito.refEq(value,

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

fun <T> same(value: T): T? = Mockito.same(value) ?: value
fun <T> same(value: T): T = Mockito.same(value) ?: value

inline fun <reified T : Any> spy(): T = Mockito.spy(T::class.java)!!
fun <T> spy(value: T): T = Mockito.spy(value)!!
Expand Down
24 changes: 24 additions & 0 deletions mockito-kotlin/src/test/kotlin/test/MockitoTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -983,4 +983,28 @@ class MockitoTest : TestBase() {
verify(this).nullableString(isA<String>())
}
}

@Test
fun same_withNonNullArgument() {
mock<Methods>().apply {
string("")
verify(this).string(same(""))
}
}

@Test
fun same_withNullableNonNullArgument() {
mock<Methods>().apply {
nullableString("")
verify(this).nullableString(same(""))
}
}

@Test
fun same_withNullArgument() {
mock<Methods>().apply {
nullableString(null)
verify(this).nullableString(same(null))
}
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include 'mockito-kotlin'

include 'mockito-kotlin-kt1.1'

0 comments on commit 916f186

Please sign in to comment.