Skip to content

Commit

Permalink
Fixed dependencies and some tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
mvarnagiris committed Jun 21, 2018
1 parent e7c8c66 commit ac1eebc
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion mvp-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ dependencies {
compile 'com.github.memoizr:assertk-core:1.0.0-beta.2'
compile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
compile "com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0-alpha03"
compile 'com.github.random-object-kreator:random-object-kreator:v0.2.2-alpha'
compile 'com.github.random-object-kreator:random-object-kreator:1.0.1'
}
3 changes: 2 additions & 1 deletion mvp-test/src/main/kotlin/com/mvcoding/mvp/DataTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.mvcoding.mvp.views.DataView
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.timeout
import com.nhaarman.mockitokotlin2.whenever
import io.reactivex.Observable
import io.reactivex.Scheduler
import io.reactivex.plugins.RxJavaPlugins
import org.mockito.Mockito
Expand Down Expand Up @@ -101,7 +102,7 @@ class LoadDataBehaviourAssertion<T, V : DataView<T>>(val presenter: Presenter<V>
fun verifyLoadDataBehavior() {
val viewMock = threadMock<DataView<T>>()

whenever(dataSource.data()).thenReturn(O.just(value))
whenever(dataSource.data()).thenReturn(Observable.just(value))

presenter attach viewMock() as V

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import ro.kreator.aRandom
class BehavioursTest {

val view = mock<ViewForTest>()
val dataSource = mock<(String) -> O<String>>()
val dataSource = mock<(String) -> Observable<String>>()
val input by aRandom<String>()
val data by aRandom<String>()
val mapError = { error: Throwable -> error}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class DataViewTest {
@Test
fun `loadData shows data from observable`() {
val view = mock<DataView<Int>>()
val dataSource = mock<(Int) -> O<Int>>()
whenever(dataSource(any())).thenReturn(O.just(2))
val dataSource = mock<(Int) -> Observable<Int>>()
whenever(dataSource(any())).thenReturn(Observable.just(2))
Observable.just(1).loadData(view, dataSource).subscribe()

verify(dataSource).invoke(1)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.mvcoding.mvp.views

import com.mvcoding.mvp.O
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.verify
import io.reactivex.Observable
import io.reactivex.observers.TestObserver
import org.junit.Test

Expand All @@ -13,7 +13,7 @@ class ErrorViewTest {
fun `showErrorAndComplete shows error and completes observable`() {
val throwable = Throwable()
val view = mock<ErrorView<Throwable>>()
val observable = O.error<Int>(throwable)
val observable = Observable.error<Int>(throwable)
val observer = TestObserver.create<Int>()

observable.showErrorAndComplete(view).subscribe(observer)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.mvcoding.mvp.views

import com.mvcoding.mvp.O
import com.nhaarman.mockitokotlin2.inOrder
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.verify
import com.nhaarman.mockitokotlin2.verifyNoMoreInteractions
import io.reactivex.Observable
import io.reactivex.observers.TestObserver
import io.reactivex.subjects.PublishSubject
import org.junit.Test
Expand All @@ -31,7 +31,7 @@ class LoadingViewTest {
val view = mock<LoadingView>()
val observer = TestObserver.create<Int>()

O.error<Int>(Throwable()).showHideLoading(view).subscribe(observer)
Observable.error<Int>(Throwable()).showHideLoading(view).subscribe(observer)
inOrder(view) {
verify(view).showLoading()
verify(view).hideLoading()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.mvcoding.mvp.views

import com.mvcoding.mvp.O
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.whenever
import io.reactivex.Observable
import io.reactivex.observers.TestObserver
import io.reactivex.subjects.PublishSubject
import org.junit.Test
Expand All @@ -15,7 +15,7 @@ class RefreshableViewTest {
val view = mock<RefreshableView>()
val refreshSubject = PublishSubject.create<Unit>()
whenever(view.refreshes()).thenReturn(refreshSubject)
val observable = O.just(1)
val observable = Observable.just(1)
val observer = TestObserver.create<Int>()

observable.refreshable(view).subscribe(observer)
Expand Down
1 change: 0 additions & 1 deletion mvp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "io.reactivex.rxjava2:rxkotlin:2.2.0"
compile "com.jakewharton.rxrelay2:rxrelay:2.0.0"
// compile 'com.github.mvarnagiris:mvp-test:v2.0.0-alpha7'
}

0 comments on commit ac1eebc

Please sign in to comment.