diff --git a/jdbc/src/test/java/org/springframework/transaction/support/TransactionSynchronizationManagerTest.java b/jdbc/src/test/java/org/springframework/transaction/support/TransactionSynchronizationManagerTest.java index b2b28c7d8c..b7a5784fa6 100644 --- a/jdbc/src/test/java/org/springframework/transaction/support/TransactionSynchronizationManagerTest.java +++ b/jdbc/src/test/java/org/springframework/transaction/support/TransactionSynchronizationManagerTest.java @@ -1,6 +1,37 @@ package org.springframework.transaction.support; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +import javax.sql.DataSource; +import java.sql.Connection; + +import static org.mockito.Mockito.mock; +import static org.springframework.transaction.support.TransactionSynchronizationManager.*; + class TransactionSynchronizationManagerTest { + DataSource dataSource = mock(DataSource.class); + Connection connection = mock(Connection.class); + + @Test + void 커넥션이_null이라면_null을_반환한다() { + Connection resource = getResource(dataSource); + Assertions.assertThat(resource).isNull(); + } + + @Test + void 커넥션을_반환한다() { + bindResource(dataSource, connection); + Connection resource = getResource(dataSource); + Assertions.assertThat(resource).isNotNull(); + } + + @Test + void 커넥션을_바인딩한다() { + bindResource(dataSource, connection); + Connection resource = getResource(dataSource); + Assertions.assertThat(resource).isNotNull(); + } } \ No newline at end of file