From abe798056e32f3f40fa3614670d6d24bf2aa71f9 Mon Sep 17 00:00:00 2001 From: Jaehwa Noh Date: Thu, 7 Mar 2024 08:29:59 +0900 Subject: [PATCH] Add @After to guarantee DB was closed. (#1240) * Add @After to guarantee DB was closed. Change-Id: Ic29b7d12125853c71ddaef1a997ec123bb2dfc8b * Fix spotless - style Co-authored-by: Simon Marquis --------- Co-authored-by: Simon Marquis --- .../nowinandroid/core/database/dao/NewsResourceDaoTest.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/database/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/core/database/dao/NewsResourceDaoTest.kt b/core/database/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/core/database/dao/NewsResourceDaoTest.kt index 55e817618..535ab61a7 100644 --- a/core/database/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/core/database/dao/NewsResourceDaoTest.kt +++ b/core/database/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/core/database/dao/NewsResourceDaoTest.kt @@ -27,6 +27,7 @@ import com.google.samples.apps.nowinandroid.core.database.model.asExternalModel import kotlinx.coroutines.flow.first import kotlinx.coroutines.test.runTest import kotlinx.datetime.Instant +import org.junit.After import org.junit.Before import org.junit.Test import kotlin.test.assertEquals @@ -48,6 +49,9 @@ class NewsResourceDaoTest { topicDao = db.topicDao() } + @After + fun closeDb() = db.close() + @Test fun newsResourceDao_fetches_items_by_descending_publish_date() = runTest { val newsResourceEntities = listOf(