switched tests to use JUnit4
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@765 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
parent
d3c10437c4
commit
ee4c0e7101
|
|
@ -30,6 +30,11 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.easymock.EasyMock;
|
import org.easymock.EasyMock;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.runners.JUnit4;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import org.springframework.jdbc.AbstractJdbcTests;
|
import org.springframework.jdbc.AbstractJdbcTests;
|
||||||
import org.springframework.jdbc.Customer;
|
import org.springframework.jdbc.Customer;
|
||||||
|
|
@ -42,6 +47,7 @@ import org.springframework.core.io.ClassPathResource;
|
||||||
/**
|
/**
|
||||||
* @author Thomas Risberg
|
* @author Thomas Risberg
|
||||||
*/
|
*/
|
||||||
|
@RunWith(JUnit4.class)
|
||||||
public class GenericSqlQueryTests extends AbstractJdbcTests {
|
public class GenericSqlQueryTests extends AbstractJdbcTests {
|
||||||
|
|
||||||
private static final String SELECT_ID_FORENAME_NAMED_PARAMETERS_PARSED =
|
private static final String SELECT_ID_FORENAME_NAMED_PARAMETERS_PARSED =
|
||||||
|
|
@ -55,7 +61,8 @@ public class GenericSqlQueryTests extends AbstractJdbcTests {
|
||||||
private BeanFactory bf;
|
private BeanFactory bf;
|
||||||
|
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
@Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
mockPreparedStatement = createMock(PreparedStatement.class);
|
mockPreparedStatement = createMock(PreparedStatement.class);
|
||||||
mockResultSet = createMock(ResultSet.class);
|
mockResultSet = createMock(ResultSet.class);
|
||||||
|
|
@ -65,7 +72,8 @@ public class GenericSqlQueryTests extends AbstractJdbcTests {
|
||||||
testDataSource.setTarget(mockDataSource);
|
testDataSource.setTarget(mockDataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void tearDown() throws Exception {
|
@After
|
||||||
|
public void tearDown() throws Exception {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
if (shouldVerify()) {
|
if (shouldVerify()) {
|
||||||
EasyMock.verify(mockPreparedStatement);
|
EasyMock.verify(mockPreparedStatement);
|
||||||
|
|
@ -79,11 +87,13 @@ public class GenericSqlQueryTests extends AbstractJdbcTests {
|
||||||
EasyMock.replay(mockResultSet);
|
EasyMock.replay(mockResultSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testPlaceHoldersCustomerQuery() throws SQLException {
|
public void testPlaceHoldersCustomerQuery() throws SQLException {
|
||||||
SqlQuery query = (SqlQuery) bf.getBean("queryWithPlaceHolders");
|
SqlQuery query = (SqlQuery) bf.getBean("queryWithPlaceHolders");
|
||||||
testCustomerQuery(query, false);
|
testCustomerQuery(query, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testNamedParameterCustomerQuery() throws SQLException {
|
public void testNamedParameterCustomerQuery() throws SQLException {
|
||||||
SqlQuery query = (SqlQuery) bf.getBean("queryWithNamedParameters");
|
SqlQuery query = (SqlQuery) bf.getBean("queryWithNamedParameters");
|
||||||
testCustomerQuery(query, true);
|
testCustomerQuery(query, true);
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.runners.JUnit4;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import org.springframework.jdbc.AbstractJdbcTests;
|
import org.springframework.jdbc.AbstractJdbcTests;
|
||||||
import org.springframework.jdbc.datasource.TestDataSourceWrapper;
|
import org.springframework.jdbc.datasource.TestDataSourceWrapper;
|
||||||
|
|
@ -41,6 +43,7 @@ import org.springframework.core.io.ClassPathResource;
|
||||||
/**
|
/**
|
||||||
* @author Thomas Risberg
|
* @author Thomas Risberg
|
||||||
*/
|
*/
|
||||||
|
@RunWith(JUnit4.class)
|
||||||
public class GenericStoredProcedureTests extends AbstractJdbcTests {
|
public class GenericStoredProcedureTests extends AbstractJdbcTests {
|
||||||
|
|
||||||
private final boolean debugEnabled = LogFactory.getLog(JdbcTemplate.class).isDebugEnabled();
|
private final boolean debugEnabled = LogFactory.getLog(JdbcTemplate.class).isDebugEnabled();
|
||||||
|
|
@ -50,7 +53,7 @@ public class GenericStoredProcedureTests extends AbstractJdbcTests {
|
||||||
private BeanFactory bf;
|
private BeanFactory bf;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
mockCallable = createMock(CallableStatement.class);
|
mockCallable = createMock(CallableStatement.class);
|
||||||
bf = new XmlBeanFactory(
|
bf = new XmlBeanFactory(
|
||||||
|
|
@ -60,7 +63,7 @@ public class GenericStoredProcedureTests extends AbstractJdbcTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
if (shouldVerify()) {
|
if (shouldVerify()) {
|
||||||
EasyMock.verify(mockCallable);
|
EasyMock.verify(mockCallable);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue