diff --git a/app/src/androidTest/java/org/schabi/newpipe/database/FeedDAOTest.kt b/app/src/androidTest/java/org/schabi/newpipe/database/FeedDAOTest.kt index 893ae82b7f9..2d8138defe3 100644 --- a/app/src/androidTest/java/org/schabi/newpipe/database/FeedDAOTest.kt +++ b/app/src/androidTest/java/org/schabi/newpipe/database/FeedDAOTest.kt @@ -3,7 +3,7 @@ package org.schabi.newpipe.database import android.content.Context import androidx.room.Room import androidx.test.core.app.ApplicationProvider -import io.reactivex.rxjava3.core.Single +import kotlinx.coroutines.runBlocking import org.junit.After import org.junit.Assert.assertEquals import org.junit.Assert.assertNotNull @@ -22,7 +22,6 @@ import org.schabi.newpipe.extractor.channel.ChannelInfo import org.schabi.newpipe.extractor.stream.StreamType import java.io.IOException import java.time.OffsetDateTime -import kotlin.streams.toList class FeedDAOTest { private lateinit var db: AppDatabase @@ -94,17 +93,13 @@ class FeedDAOTest { ) } - private fun setupUnlinkDelete(time: String) { + private fun setupUnlinkDelete(time: String) = runBlocking { clearAndFillTables() - Single.fromCallable { - feedDAO.unlinkStreamsOlderThan(OffsetDateTime.parse(time)) - }.blockingSubscribe() - Single.fromCallable { - streamDAO.deleteOrphans() - }.blockingSubscribe() + feedDAO.unlinkStreamsOlderThan(OffsetDateTime.parse(time)) + streamDAO.deleteOrphans() } - private fun clearAndFillTables() { + private suspend fun clearAndFillTables() { db.clearAllTables() streamDAO.insertAll(allStreams) subscriptionDAO.insertAll(