Skip to content

Commit 24108bd

Browse files
authored
Merge pull request #98 from nhaarman/release-0.9.0
Release 0.9.0
2 parents 5878bbe + 6126454 commit 24108bd

File tree

8 files changed

+92
-83
lines changed

8 files changed

+92
-83
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Mockito-Kotlin
2-
[ ![Download](https://api.bintray.com/packages/nhaarman/maven/Mockito-Kotlin/images/download.svg) ](https://bintray.com/nhaarman/maven/Mockito-Kotlin/_latestVersion)
2+
[ ![Download](https://maven-badges.herokuapp.com/maven-central/com.nhaarman/mockito-kotlin/badge.svg) ](https://maven-badges.herokuapp.com/maven-central/com.nhaarman/mockito-kotlin)
33

44
A small library that provides helper functions to work with [Mockito](https://github.com/mockito/mockito) in Kotlin.
55

66
## Install
77

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

1111
```groovy
1212
repositories {
13-
jcenter()
13+
mavenCentral()
1414
}
1515
dependencies {
1616
testCompile "com.nhaarman:mockito-kotlin:x.x.x"

RELEASING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
To publish a release:
2+
3+
- Tag the commit on master: `git tag -a x.x.x -m x.x.x && git push --tags`
4+
- Execute the release process: `./gradlew clean test uploadArchives -PisRelease=true`
5+
- Head to https://oss.sonatype.org/#stagingRepositories to close and release the deployment.
6+
- Don't forget to publish the tag on Github with release notes :)

build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
plugins {
2-
id "com.jfrog.bintray" version "1.7.1"
32
id 'com.github.ben-manes.versions' version '0.13.0'
43
}
5-
apply plugin: 'maven'
6-
apply plugin: 'maven-publish'
74

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

mockito-kotlin/build.gradle

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
apply plugin: 'kotlin'
22
apply from: './publishing.gradle'
3+
apply plugin: 'org.jetbrains.dokka'
34

45
buildscript {
56
ext.kotlin_version = '1.0.4'
67

78
repositories {
89
mavenCentral()
10+
jcenter()
911
}
1012

1113
dependencies {
1214
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15+
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.9"
1316
}
1417
}
1518

@@ -42,9 +45,21 @@ test.dependsOn testInlineMockito
4245
dependencies {
4346
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
4447
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
45-
compile "org.mockito:mockito-core:2.2.1"
48+
compile "org.mockito:mockito-core:2.2.6"
4649

4750
/* Tests */
4851
testCompile "junit:junit:4.12"
4952
testCompile "com.nhaarman:expect.kt:0.6.0"
5053
}
54+
55+
dokka {
56+
outputFormat = 'html'
57+
outputDirectory = "$buildDir/javadoc"
58+
59+
linkMapping {
60+
dir = "src/main/kotlin"
61+
url = "https://github.com/nhaarman/mockito-kotlin/tree/master/mockito-kotlin/src/main/kotlin"
62+
suffix = "#L"
63+
}
64+
}
65+
javadoc.dependsOn dokka

mockito-kotlin/publishing.gradle

Lines changed: 60 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,71 @@
1-
publishing {
2-
publications {
3-
MyPublication(MavenPublication) {
4-
from components.java
5-
artifact javadocJar
6-
artifact sourcesJar
7-
8-
groupId 'com.nhaarman'
9-
artifactId 'mockito-kotlin'
10-
version rootProject.ext.versionName
11-
}
12-
}
13-
}
1+
apply plugin: 'maven'
2+
apply plugin: 'signing'
143

15-
bintray {
16-
user = hasProperty('bintray_user') ? bintray_user : System.getenv('BINTRAY_USER')
17-
key = hasProperty('bintray_key') ? bintray_key : System.getenv('BINTRAY_KEY')
18-
publications = ['MyPublication']
4+
group = 'com.nhaarman'
5+
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')
198

20-
pkg {
21-
repo = 'maven'
22-
name = "Mockito-Kotlin"
23-
desc = "Using Mockito with Kotlin"
24-
25-
licenses = ['MIT']
26-
vcsUrl = 'https://github.com/bintray/gradle-bintray-plugin.git'
27-
28-
version {
29-
name = rootProject.ext.versionName
30-
desc = 'Using Mockito with Kotlin'
31-
vcsTag = rootProject.ext.versionName
32-
}
33-
}
34-
}
359

3610
task javadocJar(type: Jar, dependsOn: javadoc) {
3711
classifier = 'javadoc'
38-
from 'build/docs/javadoc'
12+
from 'build/javadoc'
3913
}
4014

4115
task sourcesJar(type: Jar) {
4216
from sourceSets.main.allSource
4317
classifier = 'sources'
18+
}
19+
20+
artifacts {
21+
archives jar
22+
23+
archives javadocJar
24+
archives sourcesJar
25+
}
26+
27+
signing {
28+
sign configurations.archives
29+
}
30+
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 {
44+
name 'Mockito-Kotlin'
45+
packaging 'jar'
46+
description 'Using Mockito with Kotlin.'
47+
url 'https://github.com/nhaarman/mockito-kotlin'
48+
49+
scm {
50+
url 'scm:git@github.com:nhaarman/mockito-kotlin.git'
51+
connection 'scm:git@github.com:nhaarman/mockito-kotlin.git'
52+
developerConnection 'scm:git@github.com:nhaarman/mockito-kotlin.git'
53+
}
54+
55+
licenses {
56+
license {
57+
name 'MIT'
58+
distribution 'repo'
59+
}
60+
}
61+
62+
developers {
63+
developer {
64+
id 'nhaarman'
65+
name 'Niek Haarman'
66+
}
67+
}
68+
}
69+
}
70+
}
4471
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ inline fun <reified T : Any> argumentCaptor(): KArgumentCaptor<T> = KArgumentCap
3232

3333
inline fun <reified T : Any> capture(captor: ArgumentCaptor<T>): T = captor.capture() ?: createInstance<T>()
3434

35-
@Deprecated("Use captor.capture() instead.", ReplaceWith("captor.capture()"))
35+
@Deprecated("Use captor.capture() instead.", ReplaceWith("captor.capture()"), DeprecationLevel.ERROR)
3636
inline fun <reified T : Any> capture(captor: KArgumentCaptor<T>): T = captor.capture()
3737

3838
class KArgumentCaptor<out T : Any>(private val captor: ArgumentCaptor<T>, private val tClass: KClass<T>) {
@@ -51,7 +51,7 @@ class KArgumentCaptor<out T : Any>(private val captor: ArgumentCaptor<T>, privat
5151
* Instead, use [argumentCaptor] in the traditional way, or use one of
5252
* [argThat], [argForWhich] or [check].
5353
*/
54-
@Deprecated("Use argumentCaptor() or argThat() instead.")
54+
@Deprecated("Use argumentCaptor() or argThat() instead.", ReplaceWith("check(consumer)"), DeprecationLevel.ERROR)
5555
inline fun <reified T : Any> capture(noinline consumer: (T) -> Unit): T {
5656
var times = 0
5757
return argThat { if (++times == 1) consumer.invoke(this); true }

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,14 @@ fun verifyZeroInteractions(vararg mocks: Any) = Mockito.verifyZeroInteractions(*
130130
fun <T> whenever(methodCall: T): OngoingStubbing<T> = Mockito.`when`(methodCall)!!
131131
fun withSettings(): MockSettings = Mockito.withSettings()!!
132132

133-
@Deprecated("Use any() instead.", ReplaceWith("any()"))
133+
@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR)
134134
inline fun <reified T : Any> anyCollection(): Collection<T> = any()
135135

136-
@Deprecated("Use any() instead.", ReplaceWith("any()"))
136+
@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR)
137137
inline fun <reified T : Any> anyList(): List<T> = any()
138138

139-
@Deprecated("Use any() instead.", ReplaceWith("any()"))
139+
@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR)
140140
inline fun <reified T : Any> anySet(): Set<T> = any()
141141

142-
@Deprecated("Use any() instead.", ReplaceWith("any()"))
142+
@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR)
143143
inline fun <reified K : Any, reified V : Any> anyMap(): Map<K, V> = any()

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

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -73,42 +73,6 @@ class MockitoTest {
7373
}
7474
}
7575

76-
@Test
77-
fun anyCollectionOfClosed() {
78-
mock<Methods>().apply {
79-
closedCollection(listOf())
80-
verify(this).closedCollection(any())
81-
verify(this).closedCollection(anyCollection())
82-
}
83-
}
84-
85-
@Test
86-
fun anyListOfClosed() {
87-
mock<Methods>().apply {
88-
closedList(listOf())
89-
verify(this).closedList(any())
90-
verify(this).closedList(anyList())
91-
}
92-
}
93-
94-
@Test
95-
fun anyClosedStringMap() {
96-
mock<Methods>().apply {
97-
closedStringMap(mapOf())
98-
verify(this).closedStringMap(any())
99-
verify(this).closedStringMap(anyMap())
100-
}
101-
}
102-
103-
@Test
104-
fun anyClosedSet() {
105-
mock<Methods>().apply {
106-
closedSet(setOf())
107-
verify(this).closedSet(any())
108-
verify(this).closedSet(anySet())
109-
}
110-
}
111-
11276
@Test
11377
fun anyStringVararg() {
11478
mock<Methods>().apply {

0 commit comments

Comments
 (0)