Skip to content

Commit

Permalink
Merge pull request #130 from nhaarman/release-1.0.0-RC1
Browse files Browse the repository at this point in the history
Release 1.0.0-RC1
  • Loading branch information
nhaarman committed Dec 3, 2016
2 parents 7fb4bd9 + 5418cff commit 04cd24d
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ matrix:
- jdk: oraclejdk7
env: TERM=dumb MOCK_MAKER=mock-maker-inline KOTLIN_VERSION=1.0.5-2
- jdk: oraclejdk7
env: TERM=dumb MOCK_MAKER=mock-maker-inline KOTLIN_VERSION=1.1-M02
env: TERM=dumb MOCK_MAKER=mock-maker-inline KOTLIN_VERSION=1.1-M03
- jdk: oraclejdk8
env: TERM=dumb KOTLIN_VERSION=1.0.5-2
- jdk: oraclejdk8
env: TERM=dumb KOTLIN_VERSION=1.1-M02
env: TERM=dumb KOTLIN_VERSION=1.1-M03


env:
Expand Down
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@ A small library that provides helper functions to work with [Mockito](https://gi

## Install

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

```groovy
repositories {
mavenCentral()
}
dependencies {
testCompile "com.nhaarman:mockito-kotlin:x.x.x"
}
testCompile "com.nhaarman:mockito-kotlin:x.x.x"
```

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

```kotlin
@Test
fun a(){
fun doAction_doesSomething(){
/* Given */
val mock = mock<MyClass> {
on { getText() } doReturn "text"
Expand Down
2 changes: 2 additions & 0 deletions mockito-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.9"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3"
classpath "com.github.dcendents:android-maven-gradle-plugin:1.5"
}
}

Expand Down
55 changes: 38 additions & 17 deletions mockito-kotlin/publishing.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'

group = 'com.nhaarman'
version = rootProject.ext.versionName
def sonatypeUsername = hasProperty('sonatype_username') ? sonatype_username : System.getenv('SONATYPE_USERNAME')
def sonatypePassword = hasProperty('sonatype_password') ? sonatype_password : System.getenv('SONATYPE_PASSWORD')


task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
Expand All @@ -28,19 +26,10 @@ signing {
sign configurations.archives
}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2") {
authentication(
userName: sonatypeUsername,
password: sonatypePassword
)
}

pom.project {
install {
repositories.mavenInstaller {
pom {
project {
name 'Mockito-Kotlin'
packaging 'jar'
description 'Using Mockito with Kotlin.'
Expand All @@ -55,6 +44,7 @@ uploadArchives {
licenses {
license {
name 'MIT'
url 'https://opensource.org/licenses/MIT'
distribution 'repo'
}
}
Expand All @@ -68,4 +58,35 @@ uploadArchives {
}
}
}
}

bintray {
user = hasProperty('bintray_username') ? bintray_username : System.getenv('BINTRAY_USER')
key = hasProperty('bintray_key') ? bintray_key : System.getenv('BINTRAY_KEY')

configurations = ['archives']

publish = true

pkg {
repo = 'maven'
name = 'Mockito-Kotlin'
licenses = ['MIT']
vcsUrl = 'https://github.com/nhaarman/mockito-kotlin.git'

version {
name = versionName

gpg {
sign = true
}

mavenCentralSync {
sync = true
user = hasProperty('sonatype_username') ? sonatype_username : System.getenv('SONATYPE_USERNAME')
password = hasProperty('sonatype_password') ? sonatype_password : System.getenv('SONATYPE_PASSWORD')
close = '1'
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ inline fun <reified T : Any> capture(captor: ArgumentCaptor<T>): T = captor.capt

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

@Deprecated("Use lastValue", ReplaceWith("lastValue"))
val value: T
get() = captor.value

/**
* The first captured value of the argument.
* @throws IndexOutOfBoundsException if the value is not available.
Expand Down Expand Up @@ -86,18 +82,3 @@ val <T> ArgumentCaptor<T>.thirdValue: T

val <T> ArgumentCaptor<T>.lastValue: T
get() = allValues.last()

/**
* This method is deprecated because its behavior differs from the Java behavior.
* Instead, use [argumentCaptor] in the traditional way, or use one of
* [argThat], [argForWhich] or [check].
*/
@Deprecated("Use argumentCaptor(), argThat() or check() instead.", ReplaceWith("check(consumer)"), DeprecationLevel.ERROR)
inline fun <reified T : Any> capture(noinline consumer: (T) -> Unit): T {
var times = 0
return argThat { if (++times == 1) consumer.invoke(this); true }
}

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

Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,3 @@ fun verifyZeroInteractions(vararg mocks: Any) = Mockito.verifyZeroInteractions(*

fun <T> whenever(methodCall: T): OngoingStubbing<T> = Mockito.`when`(methodCall)!!
fun withSettings(): MockSettings = Mockito.withSettings()!!

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

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

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

@Deprecated("Use any() instead.", ReplaceWith("any()"), DeprecationLevel.ERROR)
inline fun <reified K : Any, reified V : Any> anyMap(): Map<K, V> = any()
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ class NullCasterTest : TestBase() {
acceptNonNullableString(s)
}

private fun acceptNonNullableString(s: String) {
private fun acceptNonNullableString(@Suppress("UNUSED_PARAMETER") s: String) {
}
}

0 comments on commit 04cd24d

Please sign in to comment.