Skip to content

Commit 04cd24d

Browse files
authored
Merge pull request #130 from nhaarman/release-1.0.0-RC1
Release 1.0.0-RC1
2 parents 7fb4bd9 + 5418cff commit 04cd24d

File tree

7 files changed

+46
-59
lines changed

7 files changed

+46
-59
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ matrix:
77
- jdk: oraclejdk7
88
env: TERM=dumb MOCK_MAKER=mock-maker-inline KOTLIN_VERSION=1.0.5-2
99
- jdk: oraclejdk7
10-
env: TERM=dumb MOCK_MAKER=mock-maker-inline KOTLIN_VERSION=1.1-M02
10+
env: TERM=dumb MOCK_MAKER=mock-maker-inline KOTLIN_VERSION=1.1-M03
1111
- jdk: oraclejdk8
1212
env: TERM=dumb KOTLIN_VERSION=1.0.5-2
1313
- jdk: oraclejdk8
14-
env: TERM=dumb KOTLIN_VERSION=1.1-M02
14+
env: TERM=dumb KOTLIN_VERSION=1.1-M03
1515

1616

1717
env:

README.md

+3-8
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,11 @@ A small library that provides helper functions to work with [Mockito](https://gi
55

66
## Install
77

8-
Mockito-Kotlin is available on Maven Central.
8+
Mockito-Kotlin is available on Maven Central and JCenter.
99
For Gradle users, add the following to your `build.gradle`, replacing `x.x.x` with the latest version:
1010

1111
```groovy
12-
repositories {
13-
mavenCentral()
14-
}
15-
dependencies {
16-
testCompile "com.nhaarman:mockito-kotlin:x.x.x"
17-
}
12+
testCompile "com.nhaarman:mockito-kotlin:x.x.x"
1813
```
1914

2015
## Example
@@ -23,7 +18,7 @@ A test using Mockito-Kotlin typically looks like the following:
2318

2419
```kotlin
2520
@Test
26-
fun a(){
21+
fun doAction_doesSomething(){
2722
/* Given */
2823
val mock = mock<MyClass> {
2924
on { getText() } doReturn "text"

mockito-kotlin/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ buildscript {
1414
dependencies {
1515
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1616
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.9"
17+
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3"
18+
classpath "com.github.dcendents:android-maven-gradle-plugin:1.5"
1719
}
1820
}
1921

mockito-kotlin/publishing.gradle

+38-17
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
apply plugin: 'maven'
21
apply plugin: 'signing'
2+
apply plugin: 'com.jfrog.bintray'
3+
apply plugin: 'com.github.dcendents.android-maven'
34

45
group = 'com.nhaarman'
56
version = rootProject.ext.versionName
6-
def sonatypeUsername = hasProperty('sonatype_username') ? sonatype_username : System.getenv('SONATYPE_USERNAME')
7-
def sonatypePassword = hasProperty('sonatype_password') ? sonatype_password : System.getenv('SONATYPE_PASSWORD')
8-
97

108
task javadocJar(type: Jar, dependsOn: javadoc) {
119
classifier = 'javadoc'
@@ -28,19 +26,10 @@ signing {
2826
sign configurations.archives
2927
}
3028

31-
uploadArchives {
32-
repositories {
33-
mavenDeployer {
34-
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
35-
36-
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2") {
37-
authentication(
38-
userName: sonatypeUsername,
39-
password: sonatypePassword
40-
)
41-
}
42-
43-
pom.project {
29+
install {
30+
repositories.mavenInstaller {
31+
pom {
32+
project {
4433
name 'Mockito-Kotlin'
4534
packaging 'jar'
4635
description 'Using Mockito with Kotlin.'
@@ -55,6 +44,7 @@ uploadArchives {
5544
licenses {
5645
license {
5746
name 'MIT'
47+
url 'https://opensource.org/licenses/MIT'
5848
distribution 'repo'
5949
}
6050
}
@@ -68,4 +58,35 @@ uploadArchives {
6858
}
6959
}
7060
}
61+
}
62+
63+
bintray {
64+
user = hasProperty('bintray_username') ? bintray_username : System.getenv('BINTRAY_USER')
65+
key = hasProperty('bintray_key') ? bintray_key : System.getenv('BINTRAY_KEY')
66+
67+
configurations = ['archives']
68+
69+
publish = true
70+
71+
pkg {
72+
repo = 'maven'
73+
name = 'Mockito-Kotlin'
74+
licenses = ['MIT']
75+
vcsUrl = 'https://github.com/nhaarman/mockito-kotlin.git'
76+
77+
version {
78+
name = versionName
79+
80+
gpg {
81+
sign = true
82+
}
83+
84+
mavenCentralSync {
85+
sync = true
86+
user = hasProperty('sonatype_username') ? sonatype_username : System.getenv('SONATYPE_USERNAME')
87+
password = hasProperty('sonatype_password') ? sonatype_password : System.getenv('SONATYPE_PASSWORD')
88+
close = '1'
89+
}
90+
}
91+
}
7192
}

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

-19
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ inline fun <reified T : Any> capture(captor: ArgumentCaptor<T>): T = captor.capt
3636

3737
class KArgumentCaptor<out T : Any?>(private val captor: ArgumentCaptor<T>, private val tClass: KClass<*>) {
3838

39-
@Deprecated("Use lastValue", ReplaceWith("lastValue"))
40-
val value: T
41-
get() = captor.value
42-
4339
/**
4440
* The first captured value of the argument.
4541
* @throws IndexOutOfBoundsException if the value is not available.
@@ -86,18 +82,3 @@ val <T> ArgumentCaptor<T>.thirdValue: T
8682

8783
val <T> ArgumentCaptor<T>.lastValue: T
8884
get() = allValues.last()
89-
90-
/**
91-
* This method is deprecated because its behavior differs from the Java behavior.
92-
* Instead, use [argumentCaptor] in the traditional way, or use one of
93-
* [argThat], [argForWhich] or [check].
94-
*/
95-
@Deprecated("Use argumentCaptor(), argThat() or check() instead.", ReplaceWith("check(consumer)"), DeprecationLevel.ERROR)
96-
inline fun <reified T : Any> capture(noinline consumer: (T) -> Unit): T {
97-
var times = 0
98-
return argThat { if (++times == 1) consumer.invoke(this); true }
99-
}
100-
101-
@Deprecated("Use captor.capture() instead.", ReplaceWith("captor.capture()"), DeprecationLevel.ERROR)
102-
inline fun <reified T : Any> capture(captor: KArgumentCaptor<T>): T = captor.capture()
103-

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

-12
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,3 @@ fun verifyZeroInteractions(vararg mocks: Any) = Mockito.verifyZeroInteractions(*
156156

157157
fun <T> whenever(methodCall: T): OngoingStubbing<T> = Mockito.`when`(methodCall)!!
158158
fun withSettings(): MockSettings = Mockito.withSettings()!!
159-
160-
@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR)
161-
inline fun <reified T : Any> anyCollection(): Collection<T> = any()
162-
163-
@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR)
164-
inline fun <reified T : Any> anyList(): List<T> = any()
165-
166-
@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR)
167-
inline fun <reified T : Any> anySet(): Set<T> = any()
168-
169-
@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR)
170-
inline fun <reified K : Any, reified V : Any> anyMap(): Map<K, V> = any()

mockito-kotlin/src/test/kotlin/test/createinstance/NullCasterTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ class NullCasterTest : TestBase() {
2828
acceptNonNullableString(s)
2929
}
3030

31-
private fun acceptNonNullableString(s: String) {
31+
private fun acceptNonNullableString(@Suppress("UNUSED_PARAMETER") s: String) {
3232
}
3333
}

0 commit comments

Comments
 (0)