/*
 * Copyright (C) 2017 Yaroslav Mytkalyk
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.doctoror.particleswallpaper.data.config

import com.doctoror.particlesdrawable.ParticlesScene
import com.doctoror.particleswallpaper.data.execution.ComputationSchedulers
import com.doctoror.particleswallpaper.data.repository.MockSettingsRepositoryFactory
import org.junit.Assert.*
import org.junit.Test
import org.mockito.Mockito.*

class SceneConfiguratorImplTest {

    @Test
    fun testSubscription() {
        val c = SceneConfiguratorImpl(ComputationSchedulers())

        assertNull(c.disposables)

        c.subscribe(mock(ParticlesScene::class.java), MockSettingsRepositoryFactory.create())

        assertNotNull(c.disposables)
        assertFalse(c.disposables!!.isDisposed)

        val disposables = c.disposables

        c.dispose()

        assertTrue(disposables!!.isDisposed)
        assertNull(c.disposables)
    }

}
/*
 * Copyright (C) 2017 Yaroslav Mytkalyk
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.doctoror.particleswallpaper.data.config

import com.doctoror.particlesdrawable.ParticlesScene
import com.doctoror.particleswallpaper.data.execution.TrampolineSchedulers
import com.doctoror.particleswallpaper.data.repository.MockSettingsRepositoryFactory
import org.junit.Assert.*
import org.junit.Test
import org.mockito.Mockito.*

class SceneConfiguratorImplTest {

    @Test
    fun testSubscription() {
        val c = SceneConfiguratorImpl(TrampolineSchedulers())

        assertNull(c.disposables)

        c.subscribe(mock(ParticlesScene::class.java), MockSettingsRepositoryFactory.create())

        assertNotNull(c.disposables)
        assertFalse(c.disposables!!.isDisposed)

        val disposables = c.disposables

        c.dispose()

        assertTrue(disposables!!.isDisposed)
        assertNull(c.disposables)
    }

}

Use TrampolineSchedulers instead of ComputationSchedulers
Use TrampolineSchedulers instead of ComputationSchedulers

Doctoror/ParticleConstellationsLiveWallpaper,Doctoror/ParticleConstellationsLiveWallpaper