Skip to content

Commit

Permalink
Merge pull request #7 from nhaarman/release-0.2.0
Browse files Browse the repository at this point in the history
Release 0.2.0
  • Loading branch information
nhaarman committed Feb 4, 2016
2 parents 8488479 + 8b93c66 commit 7cafd23
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions mockito-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.0-beta-4589"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.0-rc-1036"
}
}

Expand All @@ -16,13 +16,13 @@ repositories {
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:1.0.0-beta-4589"
compile "org.jetbrains.kotlin:kotlin-reflect:1.0.0-beta-4589"
compile "org.jetbrains.kotlin:kotlin-stdlib:1.0.0-rc-1036"
compile "org.jetbrains.kotlin:kotlin-reflect:1.0.0-rc-1036"
compile "org.mockito:mockito-core:2.0.39-beta"

/* Tests */
testCompile "junit:junit:4.12"
testCompile "com.nhaarman:expect.kt:0.3.0"
testCompile "com.nhaarman:expect.kt:0.4.0"
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private fun KClass<*>.isPrimitive() =
"String"
)

@Suppress("UNCHECKED_CAST", "IMPLICIT_CAST_TO_UNIT_OR_ANY")
@Suppress("UNCHECKED_CAST", "IMPLICIT_CAST_TO_ANY")
private fun <T : Any> KClass<T>.toDefaultPrimitiveValue(): T {
return when (simpleName) {
"Boolean" -> true
Expand All @@ -91,7 +91,7 @@ private fun <T : Any> KClass<T>.toDefaultPrimitiveValue(): T {
} as T
}

@Suppress("UNCHECKED_CAST", "IMPLICIT_CAST_TO_UNIT_OR_ANY")
@Suppress("UNCHECKED_CAST", "IMPLICIT_CAST_TO_ANY")
private fun <T : Any> KClass<T>.toArrayInstance(): T {
return when (simpleName) {
"ByteArray" -> byteArrayOf()
Expand All @@ -106,7 +106,7 @@ private fun <T : Any> KClass<T>.toArrayInstance(): T {

private fun <T : Any> KFunction<T>.newInstance(): T {
isAccessible = true
return callBy(parameters.toMap {
return callBy(parameters.associate {
it to it.type.createNullableInstance<T>()
})
}
Expand All @@ -130,7 +130,7 @@ private fun <T : Any> KType.createNullableInstance(): T? {
*/
@Suppress("UNCHECKED_CAST")
private fun <T> Class<T>.uncheckedMock(): T {
val impl = MockSettingsImpl<T>().defaultAnswer(Answers.RETURNS_DEFAULTS) as MockSettingsImpl<*>
val impl = MockSettingsImpl<T>().defaultAnswer(Answers.RETURNS_DEFAULTS) as MockSettingsImpl<T>
val creationSettings = impl.confirm(this)
return MockUtil().createMock(creationSettings) as T
return MockUtil().createMock(creationSettings)
}

0 comments on commit 7cafd23

Please sign in to comment.