diff --git a/src/main/kotlin/ch/yvu/rxpect/mockito/DefaultValueGenerator.kt b/src/main/kotlin/ch/yvu/rxpect/mockito/DefaultValueGenerator.kt index fc08866..3bf86ce 100644 --- a/src/main/kotlin/ch/yvu/rxpect/mockito/DefaultValueGenerator.kt +++ b/src/main/kotlin/ch/yvu/rxpect/mockito/DefaultValueGenerator.kt @@ -1,5 +1,6 @@ package ch.yvu.rxpect.mockito +import io.reactivex.Completable import io.reactivex.Maybe import io.reactivex.Observable import io.reactivex.Single @@ -59,6 +60,9 @@ inline fun defaultValue(): T? = Single::class -> { Single.never() as T } + Completable::class -> { + Completable.complete() as T + } else -> { null } diff --git a/src/test/kotlin/ch/yvu/rxpect/mockito/DefaultValueGeneratorTest.kt b/src/test/kotlin/ch/yvu/rxpect/mockito/DefaultValueGeneratorTest.kt index ce74498..3c465c7 100644 --- a/src/test/kotlin/ch/yvu/rxpect/mockito/DefaultValueGeneratorTest.kt +++ b/src/test/kotlin/ch/yvu/rxpect/mockito/DefaultValueGeneratorTest.kt @@ -1,5 +1,6 @@ package ch.yvu.rxpect.mockito +import io.reactivex.Completable import io.reactivex.Maybe import io.reactivex.Observable import io.reactivex.Single @@ -123,6 +124,13 @@ class DefaultValueGeneratorTest { assertThat(value, `is`(Single.never())) } + @Test + fun generatesCompletable() { + val value = defaultValue() + + assertThat(value, `is`(Completable.complete())) + } + @Test fun returnsNullForUnknownType() { val value = defaultValue()