switched tests to use JUnit4

master
Thomas Risberg 16 years ago
parent 7ccb0b6e66
commit 943e359c4a
  1. 14
      org.springframework.jdbc/src/test/java/org/springframework/jdbc/object/GenericSqlQueryTests.java
  2. 7
      org.springframework.jdbc/src/test/java/org/springframework/jdbc/object/GenericStoredProcedureTests.java

@ -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);

@ -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);

Loading…
Cancel
Save