switched tests to use JUnit4

This commit is contained in:
Thomas Risberg
2009-03-12 06:29:33 +00:00
parent 7ccb0b6e66
commit 943e359c4a
2 changed files with 17 additions and 4 deletions

View File

@@ -30,6 +30,11 @@ import java.util.Map;
import org.easymock.EasyMock;
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.Customer;
@@ -42,6 +47,7 @@ import org.springframework.core.io.ClassPathResource;
/**
* @author Thomas Risberg
*/
@RunWith(JUnit4.class)
public class GenericSqlQueryTests extends AbstractJdbcTests {
private static final String SELECT_ID_FORENAME_NAMED_PARAMETERS_PARSED =
@@ -55,7 +61,8 @@ public class GenericSqlQueryTests extends AbstractJdbcTests {
private BeanFactory bf;
protected void setUp() throws Exception {
@Before
public void setUp() throws Exception {
super.setUp();
mockPreparedStatement = createMock(PreparedStatement.class);
mockResultSet = createMock(ResultSet.class);
@@ -65,7 +72,8 @@ public class GenericSqlQueryTests extends AbstractJdbcTests {
testDataSource.setTarget(mockDataSource);
}
protected void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
super.tearDown();
if (shouldVerify()) {
EasyMock.verify(mockPreparedStatement);
@@ -79,11 +87,13 @@ public class GenericSqlQueryTests extends AbstractJdbcTests {
EasyMock.replay(mockResultSet);
}
@Test
public void testPlaceHoldersCustomerQuery() throws SQLException {
SqlQuery query = (SqlQuery) bf.getBean("queryWithPlaceHolders");
testCustomerQuery(query, false);
}
@Test
public void testNamedParameterCustomerQuery() throws SQLException {
SqlQuery query = (SqlQuery) bf.getBean("queryWithNamedParameters");
testCustomerQuery(query, true);

View File

@@ -30,6 +30,8 @@ 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.datasource.TestDataSourceWrapper;
@@ -41,6 +43,7 @@ import org.springframework.core.io.ClassPathResource;
/**
* @author Thomas Risberg
*/
@RunWith(JUnit4.class)
public class GenericStoredProcedureTests extends AbstractJdbcTests {
private final boolean debugEnabled = LogFactory.getLog(JdbcTemplate.class).isDebugEnabled();
@@ -50,7 +53,7 @@ public class GenericStoredProcedureTests extends AbstractJdbcTests {
private BeanFactory bf;
@Before
protected void setUp() throws Exception {
public void setUp() throws Exception {
super.setUp();
mockCallable = createMock(CallableStatement.class);
bf = new XmlBeanFactory(
@@ -60,7 +63,7 @@ public class GenericStoredProcedureTests extends AbstractJdbcTests {
}
@After
protected void tearDown() throws Exception {
public void tearDown() throws Exception {
super.tearDown();
if (shouldVerify()) {
EasyMock.verify(mockCallable);