-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da70f23
commit 9f3ff2a
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...t/java/org/springframework/transaction/support/TransactionSynchronizationManagerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
|
||
} |