From ee4c0e71011897a677ece0ef9c32d70f05c01020 Mon Sep 17 00:00:00 2001 From: Thomas Risberg Date: Thu, 12 Mar 2009 06:29:33 +0000 Subject: [PATCH] switched tests to use JUnit4 git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@765 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../jdbc/object/GenericSqlQueryTests.java | 14 ++++++++++++-- .../jdbc/object/GenericStoredProcedureTests.java | 7 +++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/org.springframework.jdbc/src/test/java/org/springframework/jdbc/object/GenericSqlQueryTests.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/object/GenericSqlQueryTests.java index 71dca281399..785a0458f7a 100644 --- a/org.springframework.jdbc/src/test/java/org/springframework/jdbc/object/GenericSqlQueryTests.java +++ b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/object/GenericSqlQueryTests.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); diff --git a/org.springframework.jdbc/src/test/java/org/springframework/jdbc/object/GenericStoredProcedureTests.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/object/GenericStoredProcedureTests.java index 3267a3189ff..fd96db3e39a 100644 --- a/org.springframework.jdbc/src/test/java/org/springframework/jdbc/object/GenericStoredProcedureTests.java +++ b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/object/GenericStoredProcedureTests.java @@ -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);