Apply LONG_RUNNING test group properly

See gh-24830
This commit is contained in:
Sam Brannen 2020-09-25 14:25:16 +02:00
parent e33e7d7681
commit 6aa522b3c1
2 changed files with 10 additions and 22 deletions

View File

@ -28,6 +28,8 @@ import javax.sql.DataSource;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.InOrder;
import org.springframework.core.testfixture.EnabledForTestGroups;
@ -963,18 +965,10 @@ public class DataSourceTransactionManagerTests {
ordered.verify(con).close();
}
@Test
public void testTransactionWithLongTimeout() throws Exception {
doTestTransactionWithTimeout(10);
}
@Test
public void testTransactionWithShortTimeout() throws Exception {
doTestTransactionWithTimeout(1);
}
@ParameterizedTest(name = "transaction with {0} second timeout")
@ValueSource(ints = {1, 10})
@EnabledForTestGroups(LONG_RUNNING)
private void doTestTransactionWithTimeout(int timeout) throws Exception {
public void transactionWithTimeout(int timeout) throws Exception {
PreparedStatement ps = mock(PreparedStatement.class);
given(con.getAutoCommit()).willReturn(true);
given(con.prepareStatement("some SQL statement")).willReturn(ps);

View File

@ -28,6 +28,8 @@ import javax.sql.DataSource;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.InOrder;
import org.springframework.core.testfixture.EnabledForTestGroups;
@ -969,18 +971,10 @@ public class JdbcTransactionManagerTests {
ordered.verify(con).close();
}
@Test
public void testTransactionWithLongTimeout() throws Exception {
doTestTransactionWithTimeout(10);
}
@Test
public void testTransactionWithShortTimeout() throws Exception {
doTestTransactionWithTimeout(1);
}
@ParameterizedTest(name = "transaction with {0} second timeout")
@ValueSource(ints = {1, 10})
@EnabledForTestGroups(LONG_RUNNING)
private void doTestTransactionWithTimeout(int timeout) throws Exception {
public void transactionWithTimeout(int timeout) throws Exception {
PreparedStatement ps = mock(PreparedStatement.class);
given(con.getAutoCommit()).willReturn(true);
given(con.prepareStatement("some SQL statement")).willReturn(ps);