diff --git a/filesystem/src/test/java/com/dropbox/android/external/fs3/FSAllOperationTest.kt b/filesystem/src/test/java/com/dropbox/android/external/fs3/FSAllOperationTest.kt index 4d8545267..9e4df8439 100644 --- a/filesystem/src/test/java/com/dropbox/android/external/fs3/FSAllOperationTest.kt +++ b/filesystem/src/test/java/com/dropbox/android/external/fs3/FSAllOperationTest.kt @@ -4,6 +4,7 @@ import com.dropbox.android.external.fs3.filesystem.FileSystemFactory import com.google.common.base.Charsets.UTF_8 import com.google.common.io.Files.createTempDir import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking import okio.BufferedSource import okio.buffer @@ -11,6 +12,7 @@ import okio.source import org.junit.Test import java.io.ByteArrayInputStream +@ExperimentalCoroutinesApi class FSAllOperationTest { @Test diff --git a/multicast/src/test/kotlin/com/dropbox/flow/multicast/ChannelManagerTest.kt b/multicast/src/test/kotlin/com/dropbox/flow/multicast/ChannelManagerTest.kt index 152d6dd86..441fc5b36 100644 --- a/multicast/src/test/kotlin/com/dropbox/flow/multicast/ChannelManagerTest.kt +++ b/multicast/src/test/kotlin/com/dropbox/flow/multicast/ChannelManagerTest.kt @@ -16,6 +16,7 @@ package com.dropbox.flow.multicast import com.dropbox.flow.multicast.ChannelManager.Message.Dispatch +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.coroutineScope @@ -34,6 +35,7 @@ import kotlin.test.assertEquals import kotlin.test.assertTrue import kotlin.test.fail +@ExperimentalCoroutinesApi class ChannelManagerTest { private val scope = TestCoroutineScope() private val upstream: Channel = Channel(Channel.UNLIMITED) diff --git a/multicast/src/test/kotlin/com/dropbox/flow/multicast/InfiniteMulticastTest.kt b/multicast/src/test/kotlin/com/dropbox/flow/multicast/InfiniteMulticastTest.kt index 09019e4db..51966be4b 100644 --- a/multicast/src/test/kotlin/com/dropbox/flow/multicast/InfiniteMulticastTest.kt +++ b/multicast/src/test/kotlin/com/dropbox/flow/multicast/InfiniteMulticastTest.kt @@ -15,6 +15,7 @@ */ package com.dropbox.flow.multicast +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow @@ -34,6 +35,7 @@ import kotlin.test.assertEquals * It basically waits until there is another reason to enable upstream and will receive those * values as well. */ +@ExperimentalCoroutinesApi class InfiniteMulticastTest { private val testScope = TestCoroutineScope() private val dispatchLog = mutableListOf() diff --git a/multicast/src/test/kotlin/com/dropbox/flow/multicast/MulticastTest.kt b/multicast/src/test/kotlin/com/dropbox/flow/multicast/MulticastTest.kt index f016796cd..26a8cca27 100644 --- a/multicast/src/test/kotlin/com/dropbox/flow/multicast/MulticastTest.kt +++ b/multicast/src/test/kotlin/com/dropbox/flow/multicast/MulticastTest.kt @@ -16,6 +16,7 @@ package com.dropbox.flow.multicast import kotlinx.coroutines.CompletableDeferred +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow @@ -42,6 +43,7 @@ import kotlin.test.assertFailsWith import kotlin.test.assertFalse import kotlin.test.assertTrue +@ExperimentalCoroutinesApi class MulticastTest { private val testScope = TestCoroutineScope() diff --git a/multicast/src/test/kotlin/com/dropbox/flow/multicast/SharedFlowProducerTest.kt b/multicast/src/test/kotlin/com/dropbox/flow/multicast/SharedFlowProducerTest.kt index ba0706d21..39ab25752 100644 --- a/multicast/src/test/kotlin/com/dropbox/flow/multicast/SharedFlowProducerTest.kt +++ b/multicast/src/test/kotlin/com/dropbox/flow/multicast/SharedFlowProducerTest.kt @@ -15,6 +15,7 @@ */ package com.dropbox.flow.multicast +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestCoroutineScope @@ -22,6 +23,7 @@ import org.junit.Test import kotlin.test.assertEquals import kotlin.test.assertTrue +@ExperimentalCoroutinesApi class SharedFlowProducerTest { private val scope = TestCoroutineScope() private val upstreamMessages = mutableListOf() diff --git a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/FlowTestExt.kt b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/FlowTestExt.kt index dbbbc1c60..bae714d88 100644 --- a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/FlowTestExt.kt +++ b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/FlowTestExt.kt @@ -19,16 +19,19 @@ import com.google.common.truth.FailureMetadata import com.google.common.truth.Subject import com.google.common.truth.Truth import com.google.common.truth.Truth.assertWithMessage +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.collect import kotlinx.coroutines.test.TestCoroutineScope +@OptIn(ExperimentalCoroutinesApi::class) internal fun TestCoroutineScope.assertThat(flow: Flow): FlowSubject { return Truth.assertAbout(FlowSubject.Factory(this)).that(flow) } +@OptIn(ExperimentalCoroutinesApi::class) internal class FlowSubject constructor( failureMetadata: FailureMetadata, private val testCoroutineScope: TestCoroutineScope, diff --git a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/HotRxSingleStoreTest.kt b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/HotRxSingleStoreTest.kt index 5df742ee3..5f5863816 100644 --- a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/HotRxSingleStoreTest.kt +++ b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/HotRxSingleStoreTest.kt @@ -9,6 +9,8 @@ import com.dropbox.android.external.store4.StoreResponse import com.dropbox.store.rx2.ofResultSingle import com.google.common.truth.Truth.assertThat import io.reactivex.Single +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test @@ -16,6 +18,8 @@ import org.junit.runner.RunWith import org.junit.runners.JUnit4 @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class HotRxSingleStoreTest { private val testScope = TestCoroutineScope() diff --git a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxFlowableStoreTest.kt b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxFlowableStoreTest.kt index 29595a128..cbbcb750f 100644 --- a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxFlowableStoreTest.kt +++ b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxFlowableStoreTest.kt @@ -15,12 +15,16 @@ import io.reactivex.BackpressureStrategy import io.reactivex.Completable import io.reactivex.Flowable import io.reactivex.schedulers.TestScheduler +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 import java.util.concurrent.atomic.AtomicInteger @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class RxFlowableStoreTest { private val testScheduler = TestScheduler() private val atomicInteger = AtomicInteger(0) diff --git a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreExtensionsTest.kt b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreExtensionsTest.kt index 32da2e5dd..e99d5f94e 100644 --- a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreExtensionsTest.kt +++ b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreExtensionsTest.kt @@ -6,14 +6,16 @@ import com.dropbox.android.external.store4.FetcherResult import com.dropbox.android.external.store4.SourceOfTruth import com.dropbox.android.external.store4.StoreBuilder import com.dropbox.store.rx2.freshSingle -import com.dropbox.store.rx2.getSingle import com.dropbox.store.rx2.ofMaybe +import com.dropbox.store.rx2.getSingle import com.dropbox.store.rx2.ofResultSingle import com.dropbox.store.rx2.withScheduler import io.reactivex.Completable import io.reactivex.Maybe import io.reactivex.Single import io.reactivex.schedulers.Schedulers +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 @@ -21,6 +23,8 @@ import java.util.concurrent.atomic.AtomicInteger @ExperimentalStoreApi @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class RxSingleStoreExtensionsTest { private val atomicInteger = AtomicInteger(0) private var fakeDisk = mutableMapOf() diff --git a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreTest.kt b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreTest.kt index 836bdf911..4c62d7c41 100644 --- a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreTest.kt +++ b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreTest.kt @@ -4,20 +4,22 @@ import com.dropbox.android.external.store4.ExperimentalStoreApi import com.dropbox.android.external.store4.Fetcher import com.dropbox.android.external.store4.FetcherResult import com.dropbox.android.external.store4.ResponseOrigin -import com.dropbox.android.external.store4.SourceOfTruth import com.dropbox.android.external.store4.StoreBuilder import com.dropbox.android.external.store4.StoreRequest import com.dropbox.android.external.store4.StoreResponse +import com.dropbox.android.external.store4.SourceOfTruth +import com.dropbox.store.rx2.ofMaybe import com.dropbox.store.rx2.observe import com.dropbox.store.rx2.observeClear import com.dropbox.store.rx2.observeClearAll -import com.dropbox.store.rx2.ofMaybe import com.dropbox.store.rx2.ofResultSingle import com.dropbox.store.rx2.withScheduler import io.reactivex.Completable import io.reactivex.Maybe import io.reactivex.Single import io.reactivex.schedulers.Schedulers +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 @@ -25,6 +27,8 @@ import java.util.concurrent.atomic.AtomicInteger @ExperimentalStoreApi @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class RxSingleStoreTest { private val atomicInteger = AtomicInteger(0) private var fakeDisk = mutableMapOf() diff --git a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/FlowTestExt.kt b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/FlowTestExt.kt index 2e5304311..86dd0a597 100644 --- a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/FlowTestExt.kt +++ b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/FlowTestExt.kt @@ -19,12 +19,14 @@ import com.google.common.truth.FailureMetadata import com.google.common.truth.Subject import com.google.common.truth.Truth import com.google.common.truth.Truth.assertWithMessage +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.collect import kotlinx.coroutines.test.TestCoroutineScope +@OptIn(ExperimentalCoroutinesApi::class) internal fun TestCoroutineScope.assertThat(flow: Flow): FlowSubject { return Truth.assertAbout( FlowSubject.Factory( @@ -33,6 +35,7 @@ internal fun TestCoroutineScope.assertThat(flow: Flow): FlowSubject { ).that(flow) } +@OptIn(ExperimentalCoroutinesApi::class) internal class FlowSubject constructor( failureMetadata: FailureMetadata, private val testCoroutineScope: TestCoroutineScope, diff --git a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/HotRxSingleStoreTest.kt b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/HotRxSingleStoreTest.kt index a93d4341b..b35e751dc 100644 --- a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/HotRxSingleStoreTest.kt +++ b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/HotRxSingleStoreTest.kt @@ -9,6 +9,8 @@ import com.dropbox.android.external.store4.StoreResponse import com.dropbox.store.rx3.ofResultSingle import com.google.common.truth.Truth.assertThat import io.reactivex.rxjava3.core.Single +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test @@ -16,6 +18,8 @@ import org.junit.runner.RunWith import org.junit.runners.JUnit4 @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class HotRxSingleStoreTest { private val testScope = TestCoroutineScope() diff --git a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxFlowableStoreTest.kt b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxFlowableStoreTest.kt index 968be1533..7136c5e5f 100644 --- a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxFlowableStoreTest.kt +++ b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxFlowableStoreTest.kt @@ -15,12 +15,16 @@ import io.reactivex.rxjava3.core.BackpressureStrategy import io.reactivex.rxjava3.core.Completable import io.reactivex.rxjava3.core.Flowable import io.reactivex.rxjava3.schedulers.TestScheduler +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 import java.util.concurrent.atomic.AtomicInteger @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class RxFlowableStoreTest { private val testScheduler = TestScheduler() private val atomicInteger = AtomicInteger(0) diff --git a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreExtensionsTest.kt b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreExtensionsTest.kt index 07573bbf5..62a15614c 100644 --- a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreExtensionsTest.kt +++ b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreExtensionsTest.kt @@ -6,14 +6,16 @@ import com.dropbox.android.external.store4.FetcherResult import com.dropbox.android.external.store4.SourceOfTruth import com.dropbox.android.external.store4.StoreBuilder import com.dropbox.store.rx3.freshSingle -import com.dropbox.store.rx3.getSingle import com.dropbox.store.rx3.ofMaybe +import com.dropbox.store.rx3.getSingle import com.dropbox.store.rx3.ofResultSingle import com.dropbox.store.rx3.withScheduler import io.reactivex.rxjava3.core.Completable import io.reactivex.rxjava3.core.Maybe import io.reactivex.rxjava3.core.Single import io.reactivex.rxjava3.schedulers.Schedulers +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 @@ -21,6 +23,8 @@ import java.util.concurrent.atomic.AtomicInteger @ExperimentalStoreApi @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class RxSingleStoreExtensionsTest { private val atomicInteger = AtomicInteger(0) private var fakeDisk = mutableMapOf() diff --git a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreTest.kt b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreTest.kt index 3bffcab28..9a2cff01a 100644 --- a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreTest.kt +++ b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreTest.kt @@ -18,6 +18,8 @@ import io.reactivex.rxjava3.core.Completable import io.reactivex.rxjava3.core.Maybe import io.reactivex.rxjava3.core.Single import io.reactivex.rxjava3.schedulers.Schedulers +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 @@ -25,6 +27,8 @@ import java.util.concurrent.atomic.AtomicInteger @ExperimentalStoreApi @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class RxSingleStoreTest { private val atomicInteger = AtomicInteger(0) private var fakeDisk = mutableMapOf() diff --git a/store/src/main/java/com/dropbox/android/external/store4/StoreBuilder.kt b/store/src/main/java/com/dropbox/android/external/store4/StoreBuilder.kt index e45d59368..755cca902 100644 --- a/store/src/main/java/com/dropbox/android/external/store4/StoreBuilder.kt +++ b/store/src/main/java/com/dropbox/android/external/store4/StoreBuilder.kt @@ -55,7 +55,7 @@ interface StoreBuilder { * * @param fetcher a [Fetcher] flow of network records. */ - @ExperimentalTime + @OptIn(ExperimentalTime::class) fun from( fetcher: Fetcher ): StoreBuilder = RealStoreBuilder(fetcher) @@ -66,7 +66,7 @@ interface StoreBuilder { * @param fetcher a function for fetching a flow of network records. * @param sourceOfTruth a [SourceOfTruth] for the store. */ - @ExperimentalTime + @OptIn(ExperimentalTime::class) fun from( fetcher: Fetcher, sourceOfTruth: SourceOfTruth @@ -77,7 +77,7 @@ interface StoreBuilder { } } -@ExperimentalTime +@OptIn(ExperimentalTime::class) private class RealStoreBuilder( private val fetcher: Fetcher, private val sourceOfTruth: SourceOfTruth? = null diff --git a/store/src/test/java/com/dropbox/android/external/store3/DontCacheErrorsTest.kt b/store/src/test/java/com/dropbox/android/external/store3/DontCacheErrorsTest.kt index 91d45a6f4..5c7e35d2d 100644 --- a/store/src/test/java/com/dropbox/android/external/store3/DontCacheErrorsTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store3/DontCacheErrorsTest.kt @@ -1,16 +1,19 @@ package com.dropbox.android.external.store3 -import com.dropbox.android.external.store4.Fetcher import com.dropbox.android.external.store4.get +import com.dropbox.android.external.store4.Fetcher + +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Assert.fail import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized -import kotlin.time.ExperimentalTime -@ExperimentalTime +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(Parameterized::class) class DontCacheErrorsTest( storeType: TestStoreType diff --git a/store/src/test/java/com/dropbox/android/external/store3/NoNetworkTest.kt b/store/src/test/java/com/dropbox/android/external/store3/NoNetworkTest.kt index 165657430..5c80d9bc7 100644 --- a/store/src/test/java/com/dropbox/android/external/store3/NoNetworkTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store3/NoNetworkTest.kt @@ -4,6 +4,8 @@ import com.dropbox.android.external.store4.Fetcher import com.dropbox.android.external.store4.Store import com.dropbox.android.external.store4.get import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Assert.fail @@ -11,6 +13,8 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(Parameterized::class) class NoNetworkTest( storeType: TestStoreType diff --git a/store/src/test/java/com/dropbox/android/external/store3/SequentialTest.kt b/store/src/test/java/com/dropbox/android/external/store3/SequentialTest.kt index 8fb27762a..07b838229 100644 --- a/store/src/test/java/com/dropbox/android/external/store3/SequentialTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store3/SequentialTest.kt @@ -3,15 +3,17 @@ package com.dropbox.android.external.store3 import com.dropbox.android.external.store4.Fetcher import com.dropbox.android.external.store4.get import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized -import kotlin.time.ExperimentalTime -@ExperimentalTime +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(Parameterized::class) class SequentialTest( storeType: TestStoreType diff --git a/store/src/test/java/com/dropbox/android/external/store3/StoreTest.kt b/store/src/test/java/com/dropbox/android/external/store3/StoreTest.kt index c0a5f823f..360e93991 100644 --- a/store/src/test/java/com/dropbox/android/external/store3/StoreTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store3/StoreTest.kt @@ -13,6 +13,8 @@ import com.nhaarman.mockitokotlin2.never import com.nhaarman.mockitokotlin2.times import com.nhaarman.mockitokotlin2.verify import com.nhaarman.mockitokotlin2.whenever +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestCoroutineScope @@ -26,6 +28,8 @@ import java.util.concurrent.atomic.AtomicInteger import kotlin.time.ExperimentalTime @ExperimentalTime +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(Parameterized::class) class StoreTest( private val storeType: TestStoreType diff --git a/store/src/test/java/com/dropbox/android/external/store3/StreamOneKeyTest.kt b/store/src/test/java/com/dropbox/android/external/store3/StreamOneKeyTest.kt index 110ecff7f..e4e9a4ea5 100644 --- a/store/src/test/java/com/dropbox/android/external/store3/StreamOneKeyTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store3/StreamOneKeyTest.kt @@ -8,6 +8,8 @@ import com.dropbox.android.external.store4.testutil.FakeFetcher import com.google.common.truth.Truth.assertThat import com.nhaarman.mockitokotlin2.mock import com.nhaarman.mockitokotlin2.whenever +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.transform import kotlinx.coroutines.test.TestCoroutineScope @@ -17,6 +19,8 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(Parameterized::class) class StreamOneKeyTest( storeType: TestStoreType diff --git a/store/src/test/java/com/dropbox/android/external/store4/FetcherControllerTest.kt b/store/src/test/java/com/dropbox/android/external/store4/FetcherControllerTest.kt index c5d0daa2f..820b6f7f4 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/FetcherControllerTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/FetcherControllerTest.kt @@ -18,6 +18,8 @@ package com.dropbox.android.external.store4 import com.dropbox.android.external.store4.StoreResponse.Data import com.dropbox.android.external.store4.impl.FetcherController import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.delay import kotlinx.coroutines.flow.first @@ -29,6 +31,8 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 +@ExperimentalCoroutinesApi +@FlowPreview @RunWith(JUnit4::class) class FetcherControllerTest { private val testScope = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthErrorsTest.kt b/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthErrorsTest.kt index 93a8c57a2..4bfd43dab 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthErrorsTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthErrorsTest.kt @@ -21,6 +21,7 @@ import com.dropbox.android.external.store4.testutil.FakeFetcher import com.dropbox.android.external.store4.testutil.InMemoryPersister import com.dropbox.android.external.store4.testutil.asSourceOfTruth import com.dropbox.android.external.store4.testutil.assertThat +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.delay import kotlinx.coroutines.flow.flow @@ -32,9 +33,8 @@ import kotlinx.coroutines.test.runBlockingTest import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 -import kotlin.time.ExperimentalTime -@ExperimentalTime +@FlowPreview @RunWith(JUnit4::class) class SourceOfTruthErrorsTest { private val testScope = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthWithBarrierTest.kt b/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthWithBarrierTest.kt index 65658b13c..fbc44d2dc 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthWithBarrierTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthWithBarrierTest.kt @@ -23,6 +23,8 @@ import com.dropbox.android.external.store4.testutil.InMemoryPersister import com.dropbox.android.external.store4.testutil.assertThat import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CompletableDeferred +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.flow.collect @@ -33,6 +35,8 @@ import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test +@FlowPreview +@ExperimentalCoroutinesApi class SourceOfTruthWithBarrierTest { private val testScope = TestCoroutineScope() private val persister = InMemoryPersister() diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/ClearAllStoreTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/ClearAllStoreTest.kt index b28cf5d95..00c376bfc 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/ClearAllStoreTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/ClearAllStoreTest.kt @@ -9,12 +9,16 @@ import com.dropbox.android.external.store4.testutil.InMemoryPersister import com.dropbox.android.external.store4.testutil.asSourceOfTruth import com.dropbox.android.external.store4.testutil.getData import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 +@FlowPreview +@ExperimentalCoroutinesApi @ExperimentalStoreApi @RunWith(JUnit4::class) class ClearAllStoreTest { diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/ClearStoreByKeyTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/ClearStoreByKeyTest.kt index 7ea48d4e7..5d170cb5f 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/ClearStoreByKeyTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/ClearStoreByKeyTest.kt @@ -8,12 +8,16 @@ import com.dropbox.android.external.store4.testutil.InMemoryPersister import com.dropbox.android.external.store4.testutil.asSourceOfTruth import com.dropbox.android.external.store4.testutil.getData import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(JUnit4::class) class ClearStoreByKeyTest { diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/FetcherResponseTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/FetcherResponseTest.kt index c94b0378e..7e032426b 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/FetcherResponseTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/FetcherResponseTest.kt @@ -8,6 +8,8 @@ import com.dropbox.android.external.store4.StoreRequest import com.dropbox.android.external.store4.StoreResponse import com.dropbox.android.external.store4.testutil.assertThat import com.google.common.truth.Truth +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.toList @@ -15,6 +17,8 @@ import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test +@ExperimentalCoroutinesApi +@FlowPreview class FetcherResponseTest { private val testScope = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/FlowStoreTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/FlowStoreTest.kt index c7df62771..b8089ef7e 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/FlowStoreTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/FlowStoreTest.kt @@ -31,6 +31,8 @@ import com.dropbox.android.external.store4.testutil.asFlowable import com.dropbox.android.external.store4.testutil.asSourceOfTruth import com.dropbox.android.external.store4.testutil.assertThat import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.delay @@ -46,6 +48,8 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(JUnit4::class) class FlowStoreTest { private val testScope = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/HotFlowStoreTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/HotFlowStoreTest.kt index ac55a0531..7cb366f05 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/HotFlowStoreTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/HotFlowStoreTest.kt @@ -8,6 +8,8 @@ import com.dropbox.android.external.store4.StoreRequest import com.dropbox.android.external.store4.StoreResponse import com.dropbox.android.external.store4.testutil.assertThat import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestCoroutineScope @@ -16,6 +18,8 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 +@ExperimentalCoroutinesApi +@FlowPreview @RunWith(JUnit4::class) class HotFlowStoreTest { private val testScope = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/KeyTrackerTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/KeyTrackerTest.kt index e81944c78..c7c30f758 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/KeyTrackerTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/KeyTrackerTest.kt @@ -17,6 +17,7 @@ package com.dropbox.android.external.store4.impl import com.dropbox.android.external.store4.testutil.KeyTracker import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.flow.take @@ -28,6 +29,7 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 +@ExperimentalCoroutinesApi @RunWith(JUnit4::class) class KeyTrackerTest { private val scope1 = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/StoreWithInMemoryCacheTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/StoreWithInMemoryCacheTest.kt index 22122ecba..7407ddedc 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/StoreWithInMemoryCacheTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/StoreWithInMemoryCacheTest.kt @@ -4,6 +4,8 @@ import com.dropbox.android.external.store4.Fetcher import com.dropbox.android.external.store4.MemoryPolicy import com.dropbox.android.external.store4.StoreBuilder import com.dropbox.android.external.store4.get +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.runBlocking import org.junit.Test import org.junit.runner.RunWith @@ -11,7 +13,9 @@ import org.junit.runners.JUnit4 import kotlin.time.ExperimentalTime import kotlin.time.minutes +@FlowPreview @ExperimentalTime +@ExperimentalCoroutinesApi @RunWith(JUnit4::class) class StoreWithInMemoryCacheTest { diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/StreamWithoutSourceOfTruthTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/StreamWithoutSourceOfTruthTest.kt index d35656069..7bcf70b76 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/StreamWithoutSourceOfTruthTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/StreamWithoutSourceOfTruthTest.kt @@ -22,6 +22,8 @@ import com.dropbox.android.external.store4.StoreResponse import com.dropbox.android.external.store4.testutil.FakeFetcher import com.dropbox.android.external.store4.testutil.assertThat import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.delay import kotlinx.coroutines.flow.take @@ -32,6 +34,8 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(Parameterized::class) class StreamWithoutSourceOfTruthTest( private val enableCache: Boolean diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/ValueFetcherTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/ValueFetcherTest.kt index 03939a887..b8373d5e4 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/ValueFetcherTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/ValueFetcherTest.kt @@ -3,12 +3,16 @@ package com.dropbox.android.external.store4.impl import com.dropbox.android.external.store4.Fetcher import com.dropbox.android.external.store4.FetcherResult import com.dropbox.android.external.store4.testutil.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test +@ExperimentalCoroutinesApi +@FlowPreview class ValueFetcherTest { private val testScope = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/operators/MapIndexedKtTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/operators/MapIndexedKtTest.kt index b7efd1198..ba98981ab 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/operators/MapIndexedKtTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/operators/MapIndexedKtTest.kt @@ -1,11 +1,13 @@ package com.dropbox.android.external.store4.impl.operators import com.dropbox.android.external.store4.testutil.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test +@OptIn(ExperimentalCoroutinesApi::class) class MapIndexedKtTest { val scope = TestCoroutineScope() @Test diff --git a/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowSubjectTest.kt b/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowSubjectTest.kt index bb5b71189..718f911c0 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowSubjectTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowSubjectTest.kt @@ -17,6 +17,7 @@ package com.dropbox.android.external.store4.testutil import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.emitAll import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOf @@ -28,6 +29,7 @@ import org.junit.runner.RunWith import org.junit.runners.JUnit4 @RunWith(JUnit4::class) +@OptIn(ExperimentalCoroutinesApi::class) class FlowSubjectTest { // Can't use ExpectFailure in these tests because it is not a suspend function. private val testScope = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowTestExt.kt b/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowTestExt.kt index a330d12d1..a56ee679c 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowTestExt.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowTestExt.kt @@ -19,16 +19,19 @@ import com.google.common.truth.FailureMetadata import com.google.common.truth.Subject import com.google.common.truth.Truth import com.google.common.truth.Truth.assertWithMessage +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.collect import kotlinx.coroutines.test.TestCoroutineScope +@OptIn(ExperimentalCoroutinesApi::class) internal fun TestCoroutineScope.assertThat(flow: Flow): FlowSubject { return Truth.assertAbout(FlowSubject.Factory(this)).that(flow) } +@OptIn(ExperimentalCoroutinesApi::class) internal class FlowSubject constructor( failureMetadata: FailureMetadata, private val testCoroutineScope: TestCoroutineScope, diff --git a/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowableTest.kt b/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowableTest.kt index dd76c28b0..01c8df472 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowableTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowableTest.kt @@ -17,6 +17,7 @@ package com.dropbox.android.external.store4.testutil import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CompletableDeferred +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.take @@ -27,6 +28,7 @@ import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test +@ExperimentalCoroutinesApi class SimplePersisterAsFlowableTest { private val testScope = TestCoroutineScope() private val otherScope = TestCoroutineScope()