<commit_before>package io.github.droidkaigi.confsched2017.repository.contributors

import com.sys1yagi.kmockito.invoked
import com.sys1yagi.kmockito.mock
import com.taroid.knit.should
import io.github.droidkaigi.confsched2017.api.DroidKaigiClient
import io.github.droidkaigi.confsched2017.model.Contributor
import io.reactivex.Single
import org.junit.Test
import java.util.concurrent.TimeUnit

class ContributorsRemoteDataSourceTest {

    private val client = mock<DroidKaigiClient>()

    @Test
    fun findAll() {
        client.contributors.invoked.thenReturn(Single.just(listOf(
                Contributor().apply {
                    name = "Alice"
                })))

        ContributorsRemoteDataSource(client).findAll().test().run {
            await(10, TimeUnit.SECONDS).should be true
            assertNoErrors()
            assertValueCount(1)
            values()[0].size.should be 1
            values()[0][0].name.should be "Alice"
        }
    }
}<commit_msg>Use RxTestSchedulerRule instead of TestObserver#await<commit_after>package io.github.droidkaigi.confsched2017.repository.contributors

import com.sys1yagi.kmockito.invoked
import com.sys1yagi.kmockito.mock
import com.taroid.knit.should
import io.github.droidkaigi.confsched2017.api.DroidKaigiClient
import io.github.droidkaigi.confsched2017.model.Contributor
import io.github.droidkaigi.confsched2017.util.RxTestSchedulerRule
import io.reactivex.Single
import org.junit.ClassRule
import org.junit.Test

class ContributorsRemoteDataSourceTest {

    companion object {
        @ClassRule
        @JvmField
        val schedulerRule = RxTestSchedulerRule
    }

    private val client = mock<DroidKaigiClient>()

    @Test
    fun findAll() {
        client.contributors.invoked.thenReturn(Single.just(listOf(
                Contributor().apply {
                    name = "Alice"
                })))

        ContributorsRemoteDataSource(client).findAll().test().run {
            schedulerRule.testScheduler.triggerActions()
            assertNoErrors()
            assertValueCount(1)
            values()[0].size.should be 1
            values()[0][0].name.should be "Alice"
        }
    }
}
{'fraction_non_alphanumeric': 0.09587155963302753, 'fraction_numerical': 0.02018348623853211, 'mean_word_length': 2.8877005347593583, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3639756', 'n_tokens_mistral': 688, 'n_tokens_neox': 635, 'n_words': 98}