From fa66ccaa0c8522f3980e71f6112e14c952e9e251 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Tue, 10 Sep 2024 21:34:45 +0900 Subject: [PATCH] =?UTF-8?q?test:=20=E5=8B=95=E3=81=8B=E3=81=AA=E3=81=84?= =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=81=8C=E3=81=82=E3=81=A3=E3=81=9F?= =?UTF-8?q?=E3=81=AE=E3=81=A7=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExposedActorInstanceRelationshipRepositoryTest.kt | 10 ++++------ .../src/test/kotlin/utils/AbstractRepositoryTest.kt | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/hideout-core/src/test/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedActorInstanceRelationshipRepositoryTest.kt b/hideout-core/src/test/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedActorInstanceRelationshipRepositoryTest.kt index dc9183ab..2e863a1f 100644 --- a/hideout-core/src/test/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedActorInstanceRelationshipRepositoryTest.kt +++ b/hideout-core/src/test/kotlin/dev/usbharu/hideout/core/infrastructure/exposedrepository/ExposedActorInstanceRelationshipRepositoryTest.kt @@ -10,7 +10,6 @@ import kotlinx.coroutines.test.runTest import org.assertj.db.api.Assertions.assertThat import org.jetbrains.exposed.sql.transactions.TransactionManager import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance import org.junit.jupiter.api.extension.ExtendWith import org.mockito.InjectMocks import org.mockito.Mock @@ -26,7 +25,6 @@ import kotlin.test.assertEquals import kotlin.test.assertNotNull import kotlin.test.assertNull -@TestInstance(TestInstance.Lifecycle.PER_CLASS) @ExtendWith(MockitoExtension::class) class ExposedActorInstanceRelationshipRepositoryTest : AbstractRepositoryTest(ActorInstanceRelationships) { @@ -328,10 +326,6 @@ class ExposedActorInstanceRelationshipRepositoryTest : AbstractRepositoryTest(Ac dbSetup(to = dataSource) { execute(disableReferenceIntegrityConstraints) - insertInto(ActorInstanceRelationships.tableName) { - columns(ActorInstanceRelationships.columns) - values(1, 1, true, true, true) - } }.launch() val actorInstanceRelationship = ActorInstanceRelationship( @@ -350,6 +344,10 @@ class ExposedActorInstanceRelationshipRepositoryTest : AbstractRepositoryTest(Ac dbSetup(to = dataSource) { execute(disableReferenceIntegrityConstraints) + insertInto(ActorInstanceRelationships.tableName) { + columns(ActorInstanceRelationships.columns) + values(1, 1, true, true, true) + } }.launch() val actorInstanceRelationship = ActorInstanceRelationship( diff --git a/hideout-core/src/test/kotlin/utils/AbstractRepositoryTest.kt b/hideout-core/src/test/kotlin/utils/AbstractRepositoryTest.kt index 1e7b62c3..ce7a19f3 100644 --- a/hideout-core/src/test/kotlin/utils/AbstractRepositoryTest.kt +++ b/hideout-core/src/test/kotlin/utils/AbstractRepositoryTest.kt @@ -41,7 +41,7 @@ abstract class AbstractRepositoryTest(private val exposedTable: org.jetbrains.ex fun setUp() { flyway.clean() flyway.migrate() - transaction = TransactionManager.currentOrNew(Connection.TRANSACTION_READ_UNCOMMITTED) + transaction = TransactionManager.manager.newTransaction(Connection.TRANSACTION_READ_UNCOMMITTED) change = Changes(assertTable) } @@ -51,6 +51,7 @@ abstract class AbstractRepositoryTest(private val exposedTable: org.jetbrains.ex execute(Operations.sql("SET REFERENTIAL_INTEGRITY TRUE")) } transaction.rollback() + transaction.close() } companion object {