Migrate rest of test suite from JUnit 4 to JUnit Jupiter
This commit migrates the rest of Spring's test suite to JUnit Jupiter, except spring-test which will be migrated in a separate commit. See gh-23451
This commit is contained in:
@@ -20,9 +20,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
@@ -42,12 +42,12 @@ public class InitializeDatabaseIntegrationTests {
|
||||
private ClassPathXmlApplicationContext context;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void init() {
|
||||
enabled = System.setProperty("ENABLED", "true");
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void after() {
|
||||
if (enabled != null) {
|
||||
System.setProperty("ENABLED", enabled);
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.jdbc.config;
|
||||
import java.util.function.Predicate;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.PropertyValue;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.jdbc.core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.TypeMismatchException;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
|
||||
@@ -28,8 +28,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.IncorrectResultSizeDataAccessException;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class JdbcTemplateQueryTests {
|
||||
private JdbcTemplate template;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
this.connection = mock(Connection.class);
|
||||
this.dataSource = mock(DataSource.class);
|
||||
|
||||
@@ -35,8 +35,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
@@ -89,7 +89,7 @@ public class JdbcTemplateTests {
|
||||
private CallableStatement callableStatement;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
this.connection = mock(Connection.class);
|
||||
this.dataSource = mock(DataSource.class);
|
||||
|
||||
@@ -24,9 +24,9 @@ import java.sql.Statement;
|
||||
import java.sql.Types;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jdbc.datasource.SingleConnectionDataSource;
|
||||
import org.springframework.jdbc.support.SQLStateSQLExceptionTranslator;
|
||||
@@ -60,7 +60,7 @@ public class RowMapperTests {
|
||||
|
||||
private List<TestBean> result;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws SQLException {
|
||||
given(connection.createStatement()).willReturn(statement);
|
||||
given(connection.prepareStatement(anyString())).willReturn(preparedStatement);
|
||||
@@ -75,13 +75,13 @@ public class RowMapperTests {
|
||||
template.afterPropertiesSet();
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void verifyClosed() throws Exception {
|
||||
verify(resultSet).close();
|
||||
// verify(connection).close();
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void verifyResults() {
|
||||
assertThat(result).isNotNull();
|
||||
assertThat(result.size()).isEqualTo(2);
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.sql.SQLFeatureNotSupportedException;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.dao.TypeMismatchDataAccessException;
|
||||
|
||||
@@ -24,8 +24,8 @@ import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -41,7 +41,7 @@ public class StatementCreatorUtilsTests {
|
||||
private PreparedStatement preparedStatement;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
preparedStatement = mock(PreparedStatement.class);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.jdbc.core.namedparam;
|
||||
import java.sql.Types;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.jdbc.core.namedparam;
|
||||
|
||||
import java.sql.Types;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jdbc.core.SqlParameterValue;
|
||||
import org.springframework.jdbc.support.JdbcUtils;
|
||||
|
||||
@@ -30,9 +30,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.InOrder;
|
||||
|
||||
import org.springframework.jdbc.Customer;
|
||||
@@ -95,7 +95,7 @@ public class NamedParameterJdbcTemplateTests {
|
||||
private NamedParameterJdbcTemplate namedParameterTemplate;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
connection = mock(Connection.class);
|
||||
dataSource = mock(DataSource.class);
|
||||
@@ -150,7 +150,7 @@ public class NamedParameterJdbcTemplateTests {
|
||||
verify(connection).close();
|
||||
}
|
||||
|
||||
@Ignore("SPR-16340")
|
||||
@Disabled("SPR-16340")
|
||||
@Test
|
||||
public void testExecuteArray() throws SQLException {
|
||||
given(preparedStatement.executeUpdate()).willReturn(1);
|
||||
|
||||
@@ -30,9 +30,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
|
||||
@@ -61,7 +61,7 @@ public class NamedParameterQueryTests {
|
||||
private NamedParameterJdbcTemplate template;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
connection = mock(Connection.class);
|
||||
dataSource = mock(DataSource.class);
|
||||
@@ -76,7 +76,7 @@ public class NamedParameterQueryTests {
|
||||
given(preparedStatement.executeQuery()).willReturn(resultSet);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void verifyClose() throws Exception {
|
||||
verify(preparedStatement).close();
|
||||
verify(resultSet).close();
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jdbc.core.SqlInOutParameter;
|
||||
import org.springframework.jdbc.core.SqlOutParameter;
|
||||
@@ -55,7 +55,7 @@ public class CallMetaDataContextTests {
|
||||
private CallMetaDataContext context = new CallMetaDataContext();
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
connection = mock(Connection.class);
|
||||
databaseMetaData = mock(DatabaseMetaData.class);
|
||||
@@ -64,7 +64,7 @@ public class CallMetaDataContextTests {
|
||||
given(dataSource.getConnection()).willReturn(connection);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void verifyClosed() throws Exception {
|
||||
verify(connection).close();
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.jdbc.BadSqlGrammarException;
|
||||
@@ -57,7 +57,7 @@ public class SimpleJdbcCallTests {
|
||||
private CallableStatement callableStatement;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
connection = mock(Connection.class);
|
||||
databaseMetaData = mock(DatabaseMetaData.class);
|
||||
|
||||
@@ -22,9 +22,9 @@ import java.sql.ResultSet;
|
||||
import java.util.HashMap;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class SimpleJdbcInsertTests {
|
||||
private DataSource dataSource;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
connection = mock(Connection.class);
|
||||
databaseMetaData = mock(DatabaseMetaData.class);
|
||||
@@ -56,7 +56,7 @@ public class SimpleJdbcInsertTests {
|
||||
given(dataSource.getConnection()).willReturn(connection);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void verifyClosed() throws Exception {
|
||||
verify(connection).close();
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jdbc.core.SqlParameterValue;
|
||||
import org.springframework.jdbc.core.metadata.TableMetaDataContext;
|
||||
@@ -54,7 +54,7 @@ public class TableMetaDataContextTests {
|
||||
private TableMetaDataContext context = new TableMetaDataContext();
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
connection = mock(Connection.class);
|
||||
dataSource = mock(DataSource.class);
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.IncorrectResultSizeDataAccessException;
|
||||
|
||||
@@ -23,13 +23,15 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
import org.mockito.quality.Strictness;
|
||||
|
||||
import org.springframework.jdbc.support.lob.LobCreator;
|
||||
import org.springframework.jdbc.support.lob.LobHandler;
|
||||
@@ -56,8 +58,9 @@ import static org.mockito.Mockito.verify;
|
||||
*
|
||||
* @author Alef Arendsen
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class SqlLobValueTests {
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@MockitoSettings(strictness = Strictness.LENIENT)
|
||||
class SqlLobValueTests {
|
||||
|
||||
@Mock
|
||||
private PreparedStatement preparedStatement;
|
||||
@@ -71,13 +74,13 @@ public class SqlLobValueTests {
|
||||
@Captor
|
||||
private ArgumentCaptor<InputStream> inputStreamCaptor;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
given(handler.getLobCreator()).willReturn(creator);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test1() throws SQLException {
|
||||
void test1() throws SQLException {
|
||||
byte[] testBytes = "Bla".getBytes();
|
||||
SqlLobValue lob = new SqlLobValue(testBytes, handler);
|
||||
lob.setTypeValue(preparedStatement, 1, Types.BLOB, "test");
|
||||
@@ -85,7 +88,7 @@ public class SqlLobValueTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test2() throws SQLException {
|
||||
void test2() throws SQLException {
|
||||
String testString = "Bla";
|
||||
SqlLobValue lob = new SqlLobValue(testString, handler);
|
||||
lob.setTypeValue(preparedStatement, 1, Types.BLOB, "test");
|
||||
@@ -93,14 +96,14 @@ public class SqlLobValueTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test3() throws SQLException {
|
||||
void test3() throws SQLException {
|
||||
SqlLobValue lob = new SqlLobValue(new InputStreamReader(new ByteArrayInputStream("Bla".getBytes())), 12);
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
lob.setTypeValue(preparedStatement, 1, Types.BLOB, "test"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test4() throws SQLException {
|
||||
void test4() throws SQLException {
|
||||
String testContent = "Bla";
|
||||
SqlLobValue lob = new SqlLobValue(testContent, handler);
|
||||
lob.setTypeValue(preparedStatement, 1, Types.CLOB, "test");
|
||||
@@ -108,7 +111,7 @@ public class SqlLobValueTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test5() throws Exception {
|
||||
void test5() throws Exception {
|
||||
byte[] testContent = "Bla".getBytes();
|
||||
SqlLobValue lob = new SqlLobValue(new ByteArrayInputStream(testContent), 3, handler);
|
||||
lob.setTypeValue(preparedStatement, 1, Types.CLOB, "test");
|
||||
@@ -119,7 +122,7 @@ public class SqlLobValueTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test6() throws SQLException {
|
||||
void test6() throws SQLException {
|
||||
byte[] testContent = "Bla".getBytes();
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(testContent);
|
||||
InputStreamReader reader = new InputStreamReader(bais);
|
||||
@@ -129,14 +132,14 @@ public class SqlLobValueTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test7() throws SQLException {
|
||||
void test7() throws SQLException {
|
||||
SqlLobValue lob = new SqlLobValue("bla".getBytes());
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
lob.setTypeValue(preparedStatement, 1, Types.CLOB, "test"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOtherConstructors() throws SQLException {
|
||||
void testOtherConstructors() throws SQLException {
|
||||
// a bit BS, but we need to test them, as long as they don't throw exceptions
|
||||
|
||||
SqlLobValue lob = new SqlLobValue("bla");
|
||||
@@ -170,7 +173,7 @@ public class SqlLobValueTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCorrectCleanup() throws SQLException {
|
||||
void testCorrectCleanup() throws SQLException {
|
||||
SqlLobValue lob = new SqlLobValue("Bla", handler);
|
||||
lob.setTypeValue(preparedStatement, 1, Types.CLOB, "test");
|
||||
lob.cleanup();
|
||||
@@ -179,7 +182,7 @@ public class SqlLobValueTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOtherSqlType() throws SQLException {
|
||||
void testOtherSqlType() throws SQLException {
|
||||
SqlLobValue lob = new SqlLobValue("Bla", handler);
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
lob.setTypeValue(preparedStatement, 1, Types.SMALLINT, "test"));
|
||||
|
||||
@@ -29,9 +29,9 @@ import javax.transaction.Transaction;
|
||||
import javax.transaction.TransactionManager;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.StaticListableBeanFactory;
|
||||
import org.springframework.jdbc.datasource.lookup.BeanFactoryDataSourceLookup;
|
||||
@@ -68,7 +68,7 @@ public class DataSourceJtaTransactionTests {
|
||||
private TransactionManager transactionManager;
|
||||
private Transaction transaction;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
connection =mock(Connection.class);
|
||||
dataSource = mock(DataSource.class);
|
||||
@@ -78,7 +78,7 @@ public class DataSourceJtaTransactionTests {
|
||||
given(dataSource.getConnection()).willReturn(connection);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void verifyTransactionSynchronizationManagerState() {
|
||||
assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty()).isTrue();
|
||||
assertThat(TransactionSynchronizationManager.isSynchronizationActive()).isFalse();
|
||||
|
||||
@@ -24,9 +24,9 @@ import java.sql.Savepoint;
|
||||
import java.sql.Statement;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.InOrder;
|
||||
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
@@ -72,7 +72,7 @@ public class DataSourceTransactionManagerTests {
|
||||
private DataSourceTransactionManager tm;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
ds = mock(DataSource.class);
|
||||
con = mock(Connection.class);
|
||||
@@ -80,7 +80,7 @@ public class DataSourceTransactionManagerTests {
|
||||
tm = new DataSourceTransactionManager(ds);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void verifyTransactionSynchronizationManagerState() {
|
||||
assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty()).isTrue();
|
||||
assertThat(TransactionSynchronizationManager.isSynchronizationActive()).isFalse();
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.io.PrintWriter;
|
||||
import java.sql.Connection;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.jdbc.datasource;
|
||||
import java.sql.Connection;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.jdbc.datasource.embedded;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.io.ClassRelativeResourceLoader;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.jdbc.datasource.embedded;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.io.ClassRelativeResourceLoader;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.jdbc.datasource.embedded;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jdbc.datasource.init.DatabasePopulator;
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.jdbc.datasource.init;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
import org.springframework.core.io.ClassRelativeResourceLoader;
|
||||
import org.springframework.core.io.Resource;
|
||||
@@ -46,13 +46,13 @@ public abstract class AbstractDatabaseInitializationTests {
|
||||
JdbcTemplate jdbcTemplate;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
db = new EmbeddedDatabaseBuilder().setType(getEmbeddedDatabaseType()).build();
|
||||
jdbcTemplate = new JdbcTemplate(db);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void shutDown() {
|
||||
if (TransactionSynchronizationManager.isSynchronizationActive()) {
|
||||
TransactionSynchronizationManager.clear();
|
||||
|
||||
@@ -19,7 +19,8 @@ package org.springframework.jdbc.datasource.init;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.Timeout;
|
||||
|
||||
import org.springframework.jdbc.datasource.DataSourceUtils;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
@@ -36,7 +37,7 @@ import static org.mockito.Mockito.verify;
|
||||
* @author Sam Brannen
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseInitializationTests {
|
||||
abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseInitializationTests {
|
||||
|
||||
private static final String COUNT_DAVE_SQL = "select COUNT(NAME) from T_TEST where NAME='Dave'";
|
||||
|
||||
@@ -46,7 +47,7 @@ public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseIni
|
||||
|
||||
|
||||
@Test
|
||||
public void scriptWithSingleLineCommentsAndFailedDrop() throws Exception {
|
||||
void scriptWithSingleLineCommentsAndFailedDrop() throws Exception {
|
||||
databasePopulator.addScript(resource("db-schema-failed-drop-comments.sql"));
|
||||
databasePopulator.addScript(resource("db-test-data.sql"));
|
||||
databasePopulator.setIgnoreFailedDrops(true);
|
||||
@@ -55,7 +56,7 @@ public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseIni
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scriptWithStandardEscapedLiteral() throws Exception {
|
||||
void scriptWithStandardEscapedLiteral() throws Exception {
|
||||
databasePopulator.addScript(defaultSchema());
|
||||
databasePopulator.addScript(resource("db-test-data-escaped-literal.sql"));
|
||||
DatabasePopulatorUtils.execute(databasePopulator, db);
|
||||
@@ -63,7 +64,7 @@ public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseIni
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scriptWithMySqlEscapedLiteral() throws Exception {
|
||||
void scriptWithMySqlEscapedLiteral() throws Exception {
|
||||
databasePopulator.addScript(defaultSchema());
|
||||
databasePopulator.addScript(resource("db-test-data-mysql-escaped-literal.sql"));
|
||||
DatabasePopulatorUtils.execute(databasePopulator, db);
|
||||
@@ -71,7 +72,7 @@ public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseIni
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scriptWithMultipleStatements() throws Exception {
|
||||
void scriptWithMultipleStatements() throws Exception {
|
||||
databasePopulator.addScript(defaultSchema());
|
||||
databasePopulator.addScript(resource("db-test-data-multiple.sql"));
|
||||
DatabasePopulatorUtils.execute(databasePopulator, db);
|
||||
@@ -80,7 +81,7 @@ public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseIni
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scriptWithMultipleStatementsAndLongSeparator() throws Exception {
|
||||
void scriptWithMultipleStatementsAndLongSeparator() throws Exception {
|
||||
databasePopulator.addScript(defaultSchema());
|
||||
databasePopulator.addScript(resource("db-test-data-endings.sql"));
|
||||
databasePopulator.setSeparator("@@");
|
||||
@@ -90,7 +91,7 @@ public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseIni
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scriptWithMultipleStatementsAndWhitespaceSeparator() throws Exception {
|
||||
void scriptWithMultipleStatementsAndWhitespaceSeparator() throws Exception {
|
||||
databasePopulator.addScript(defaultSchema());
|
||||
databasePopulator.addScript(resource("db-test-data-whitespace.sql"));
|
||||
databasePopulator.setSeparator("/\n");
|
||||
@@ -100,7 +101,7 @@ public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseIni
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scriptWithMultipleStatementsAndNewlineSeparator() throws Exception {
|
||||
void scriptWithMultipleStatementsAndNewlineSeparator() throws Exception {
|
||||
databasePopulator.addScript(defaultSchema());
|
||||
databasePopulator.addScript(resource("db-test-data-newline.sql"));
|
||||
DatabasePopulatorUtils.execute(databasePopulator, db);
|
||||
@@ -109,7 +110,7 @@ public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseIni
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scriptWithMultipleStatementsAndMultipleNewlineSeparator() throws Exception {
|
||||
void scriptWithMultipleStatementsAndMultipleNewlineSeparator() throws Exception {
|
||||
databasePopulator.addScript(defaultSchema());
|
||||
databasePopulator.addScript(resource("db-test-data-multi-newline.sql"));
|
||||
databasePopulator.setSeparator("\n\n");
|
||||
@@ -119,7 +120,7 @@ public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseIni
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scriptWithEolBetweenTokens() throws Exception {
|
||||
void scriptWithEolBetweenTokens() throws Exception {
|
||||
databasePopulator.addScript(usersSchema());
|
||||
databasePopulator.addScript(resource("users-data.sql"));
|
||||
DatabasePopulatorUtils.execute(databasePopulator, db);
|
||||
@@ -127,7 +128,7 @@ public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseIni
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scriptWithCommentsWithinStatements() throws Exception {
|
||||
void scriptWithCommentsWithinStatements() throws Exception {
|
||||
databasePopulator.addScript(usersSchema());
|
||||
databasePopulator.addScript(resource("users-data-with-comments.sql"));
|
||||
DatabasePopulatorUtils.execute(databasePopulator, db);
|
||||
@@ -135,7 +136,7 @@ public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseIni
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scriptWithoutStatementSeparator() throws Exception {
|
||||
void scriptWithoutStatementSeparator() throws Exception {
|
||||
databasePopulator.setSeparator(ScriptUtils.EOF_STATEMENT_SEPARATOR);
|
||||
databasePopulator.addScript(resource("drop-users-schema.sql"));
|
||||
databasePopulator.addScript(resource("users-schema-without-separator.sql"));
|
||||
@@ -146,7 +147,7 @@ public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseIni
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorWithMultipleScriptResources() throws Exception {
|
||||
void constructorWithMultipleScriptResources() throws Exception {
|
||||
final ResourceDatabasePopulator populator = new ResourceDatabasePopulator(usersSchema(),
|
||||
resource("users-data-with-comments.sql"));
|
||||
DatabasePopulatorUtils.execute(populator, db);
|
||||
@@ -154,7 +155,7 @@ public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseIni
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scriptWithSelectStatements() throws Exception {
|
||||
void scriptWithSelectStatements() throws Exception {
|
||||
databasePopulator.addScript(defaultSchema());
|
||||
databasePopulator.addScript(resource("db-test-data-select.sql"));
|
||||
DatabasePopulatorUtils.execute(databasePopulator, db);
|
||||
@@ -166,7 +167,7 @@ public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseIni
|
||||
* See SPR-9457
|
||||
*/
|
||||
@Test
|
||||
public void usesBoundConnectionIfAvailable() throws SQLException {
|
||||
void usesBoundConnectionIfAvailable() throws SQLException {
|
||||
TransactionSynchronizationManager.initSynchronization();
|
||||
Connection connection = DataSourceUtils.getConnection(db);
|
||||
DatabasePopulator populator = mock(DatabasePopulator.class);
|
||||
@@ -177,8 +178,9 @@ public abstract class AbstractDatabasePopulatorTests extends AbstractDatabaseIni
|
||||
/**
|
||||
* See SPR-9781
|
||||
*/
|
||||
@Test(timeout = 1000)
|
||||
public void executesHugeScriptInReasonableTime() throws SQLException {
|
||||
@Test
|
||||
@Timeout(1)
|
||||
void executesHugeScriptInReasonableTime() throws SQLException {
|
||||
databasePopulator.addScript(defaultSchema());
|
||||
databasePopulator.addScript(resource("db-test-data-huge.sql"));
|
||||
DatabasePopulatorUtils.execute(databasePopulator, db);
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.sql.SQLException;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
|
||||
@@ -16,20 +16,19 @@
|
||||
|
||||
package org.springframework.jdbc.datasource.init;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author Sam Brannen
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public class H2DatabasePopulatorTests extends AbstractDatabasePopulatorTests {
|
||||
class H2DatabasePopulatorTests extends AbstractDatabasePopulatorTests {
|
||||
|
||||
@Override
|
||||
protected EmbeddedDatabaseType getEmbeddedDatabaseType() {
|
||||
return EmbeddedDatabaseType.H2;
|
||||
}
|
||||
@@ -40,7 +39,7 @@ public class H2DatabasePopulatorTests extends AbstractDatabasePopulatorTests {
|
||||
* @since 5.0
|
||||
*/
|
||||
@Test
|
||||
public void scriptWithH2Alias() throws Exception {
|
||||
void scriptWithH2Alias() throws Exception {
|
||||
databasePopulator.addScript(usersSchema());
|
||||
databasePopulator.addScript(resource("db-test-data-h2-alias.sql"));
|
||||
// Set statement separator to double newline so that ";" is not
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.jdbc.datasource.init;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.springframework.jdbc.datasource.init;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ScriptUtilsIntegrationTests extends AbstractDatabaseInitializationT
|
||||
return EmbeddedDatabaseType.HSQL;
|
||||
}
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUpSchema() throws SQLException {
|
||||
executeSqlScript(db.getConnection(), usersSchema());
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.jdbc.datasource.init;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.support.EncodedResource;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.jdbc.datasource.lookup;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanNotOfRequiredTypeException;
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.jdbc.datasource.lookup;
|
||||
import javax.naming.NamingException;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.Types;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jdbc.core.SqlParameter;
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
@@ -58,7 +58,7 @@ public class GenericSqlQueryTests {
|
||||
private ResultSet resultSet;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
this.beanFactory = new DefaultListableBeanFactory();
|
||||
new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
@@ -29,8 +29,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.IncorrectResultSizeDataAccessException;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
@@ -90,7 +90,7 @@ public class SqlQueryTests {
|
||||
private ResultSet resultSet;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
this.connection = mock(Connection.class);
|
||||
this.dataSource = mock(DataSource.class);
|
||||
|
||||
@@ -26,9 +26,9 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jdbc.JdbcUpdateAffectedIncorrectNumberOfRowsException;
|
||||
import org.springframework.jdbc.core.SqlParameter;
|
||||
@@ -80,7 +80,7 @@ public class SqlUpdateTests {
|
||||
private ResultSetMetaData resultSetMetaData;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
dataSource = mock(DataSource.class);
|
||||
connection = mock(Connection.class);
|
||||
@@ -90,7 +90,7 @@ public class SqlUpdateTests {
|
||||
given(dataSource.getConnection()).willReturn(connection);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void verifyClosed() throws Exception {
|
||||
verify(preparedStatement).close();
|
||||
verify(connection).close();
|
||||
|
||||
@@ -28,9 +28,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
@@ -73,7 +73,7 @@ public class StoredProcedureTests {
|
||||
|
||||
private boolean verifyClosedAfter = true;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
dataSource = mock(DataSource.class);
|
||||
connection = mock(Connection.class);
|
||||
@@ -82,7 +82,7 @@ public class StoredProcedureTests {
|
||||
given(callableStatement.getConnection()).willReturn(connection);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void verifyClosed() throws Exception {
|
||||
if (verifyClosedAfter) {
|
||||
verify(callableStatement).close();
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.jdbc.support;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jdbc.support.incrementer.HanaSequenceMaxValueIncrementer;
|
||||
import org.springframework.jdbc.support.incrementer.HsqlMaxValueIncrementer;
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jdbc.support.lob.DefaultLobHandler;
|
||||
import org.springframework.jdbc.support.lob.LobCreator;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.jdbc.support;
|
||||
|
||||
import java.sql.Types;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.jdbc.support;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.DataRetrievalFailureException;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.sql.BatchUpdateException;
|
||||
import java.sql.DataTruncation;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.CannotAcquireLockException;
|
||||
import org.springframework.dao.CannotSerializeTransactionException;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.sql.SQLException;
|
||||
import java.util.Arrays;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.jdbc.support;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.TransientDataAccessResourceException;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.jdbc.support;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.ConcurrencyFailureException;
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.jdbc.support;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jdbc.BadSqlGrammarException;
|
||||
import org.springframework.jdbc.UncategorizedSQLException;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.jdbc.support;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.ConcurrencyFailureException;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
@@ -25,8 +25,8 @@ import java.sql.SQLException;
|
||||
import java.sql.Time;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.jdbc.InvalidResultSetAccessException;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ResultSetWrappingRowSetTests {
|
||||
private ResultSetWrappingSqlRowSet rowSet;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
resultSet = mock(ResultSet.class);
|
||||
rowSet = new ResultSetWrappingSqlRowSet(resultSet);
|
||||
|
||||
@@ -16,13 +16,14 @@
|
||||
|
||||
package org.springframework.jdbc.core
|
||||
|
||||
import java.sql.*
|
||||
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.verify
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Test
|
||||
import java.sql.*
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
/**
|
||||
* Mock object based tests for [JdbcOperations] Kotlin extensions
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors
|
||||
* Copyright 2002-2019 the original author or authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,10 +16,11 @@
|
||||
|
||||
package org.springframework.jdbc.core.namedparam
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
import java.sql.JDBCType
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
/**
|
||||
* Tests for [MapSqlParameterSource] Kotlin extensions.
|
||||
*
|
||||
@@ -50,4 +51,5 @@ class MapSqlParameterSourceExtensionsTests {
|
||||
assertEquals(JDBCType.INTEGER.vendorTypeNumber, source.getSqlType("foo"))
|
||||
assertEquals("INT", source.getTypeName("foo"))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user