File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Data/src/test/java/co/joebirch/data/store Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ package co.joebirch.data.store
2+
3+ import com.nhaarman.mockito_kotlin.mock
4+ import org.junit.Test
5+ import kotlin.test.assertEquals
6+
7+ class ProjectsDataStoreFactoryTest {
8+
9+ private val cacheStore = mock<ProjectsCacheDataStore >()
10+ private val remoteStore = mock<ProjectsRemoteDataStore >()
11+ private val factory = ProjectsDataStoreFactory (cacheStore, remoteStore)
12+
13+ @Test
14+ fun getDataStoreReturnsRemoteStoreWhenCacheExpired () {
15+ assertEquals(remoteStore, factory.getDataStore(true , true ))
16+ }
17+
18+ @Test
19+ fun getDataStoreReturnsRemoteStoreWhenProjectsNotCached () {
20+ assertEquals(remoteStore, factory.getDataStore(false , false ))
21+ }
22+
23+ @Test
24+ fun getDataStoreReturnsCacheStore () {
25+ assertEquals(cacheStore, factory.getDataStore(true , false ))
26+ }
27+
28+ @Test
29+ fun getCacheDataStoreReturnsCacheStore () {
30+ assertEquals(cacheStore, factory.getCacheDataStore())
31+ }
32+
33+ }
You can’t perform that action at this time.
0 commit comments