diff --git a/pom.xml b/pom.xml
index 51db4a001..d404cca89 100644
--- a/pom.xml
+++ b/pom.xml
@@ -487,9 +487,9 @@
1.8.0.7
- easymock
+ org.easymock
easymock
- 1.1
+ 2.4
test
diff --git a/spring-batch-core/pom.xml b/spring-batch-core/pom.xml
index abceb52c9..1dd0f7bb9 100644
--- a/spring-batch-core/pom.xml
+++ b/spring-batch-core/pom.xml
@@ -62,7 +62,7 @@
test
- easymock
+ org.easymock
easymock
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBeanTests.java
index caada2ba1..82e327e8f 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBeanTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBeanTests.java
@@ -174,7 +174,7 @@ public class JobRepositoryFactoryBeanTests extends TestCase {
// wrong meta data
fail("Expected IllegalArgumentException");
}
- catch (AssertionFailedError e) {
+ catch (AssertionError e) {
// expected exception from txControl - wrong isolation level used in
// comparison
assertEquals("Unexpected method call", e.getMessage().substring(3, 25));
@@ -188,8 +188,14 @@ public class JobRepositoryFactoryBeanTests extends TestCase {
DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW);
transactionDefinition.setIsolationLevel(DefaultTransactionDefinition.ISOLATION_SERIALIZABLE);
txControl.expectAndReturn(transactionManager.getTransaction(transactionDefinition), null);
- dataSourceControl.expectAndReturn(dataSource.getConnection(), MockControl.createControl(Connection.class)
- .getMock());
+ MockControl connectionControl = MockControl.createControl(Connection.class);
+ Connection conn = (Connection) connectionControl.getMock();
+ conn.prepareStatement("SELECT JOB_INSTANCE_ID from TEST_BATCH_PREFIX_JOB_INSTANCE where JOB_NAME = ? and (JOB_KEY = ? OR JOB_KEY is NULL)");
+ connectionControl.setReturnValue(null);
+ conn.close();
+ connectionControl.setVoidCallable();
+ dataSourceControl.expectAndReturn(dataSource.getConnection(), conn);
+ connectionControl.replay();
dataSourceControl.replay();
txControl.replay();
try {
@@ -200,6 +206,9 @@ public class JobRepositoryFactoryBeanTests extends TestCase {
}
catch (IllegalArgumentException e) {
// expected exception from DataSourceUtils
+ System.out.println("******* " + e);
+ System.out.println("******* " + e);
+ System.out.println("******* " + e);
assertEquals("No Statement specified", e.getMessage());
}
}
@@ -212,8 +221,14 @@ public class JobRepositoryFactoryBeanTests extends TestCase {
DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW);
transactionDefinition.setIsolationLevel(DefaultTransactionDefinition.ISOLATION_READ_UNCOMMITTED);
txControl.expectAndReturn(transactionManager.getTransaction(transactionDefinition), null);
- dataSourceControl.expectAndReturn(dataSource.getConnection(), MockControl.createControl(Connection.class)
- .getMock());
+ MockControl connectionControl = MockControl.createControl(Connection.class);
+ Connection conn = (Connection) connectionControl.getMock();
+ conn.prepareStatement("SELECT JOB_INSTANCE_ID from TEST_BATCH_PREFIX_JOB_INSTANCE where JOB_NAME = ? and (JOB_KEY = ? OR JOB_KEY is NULL)");
+ connectionControl.setReturnValue(null);
+ conn.close();
+ connectionControl.setVoidCallable();
+ dataSourceControl.expectAndReturn(dataSource.getConnection(), conn);
+ connectionControl.replay();
dataSourceControl.replay();
txControl.replay();
try {
diff --git a/spring-batch-infrastructure-tests/pom.xml b/spring-batch-infrastructure-tests/pom.xml
index e4fe0a4c4..8f3f661f8 100644
--- a/spring-batch-infrastructure-tests/pom.xml
+++ b/spring-batch-infrastructure-tests/pom.xml
@@ -109,7 +109,7 @@
junit
- easymock
+ org.easymock
easymock
diff --git a/spring-batch-infrastructure/pom.xml b/spring-batch-infrastructure/pom.xml
index b2a47cc44..5cb8f5fb0 100644
--- a/spring-batch-infrastructure/pom.xml
+++ b/spring-batch-infrastructure/pom.xml
@@ -145,7 +145,7 @@
test
- easymock
+ org.easymock
easymock
diff --git a/spring-batch-samples/pom.xml b/spring-batch-samples/pom.xml
index 1be0e667b..3139d0e54 100644
--- a/spring-batch-samples/pom.xml
+++ b/spring-batch-samples/pom.xml
@@ -135,7 +135,6 @@
org.easymock
easymock
- 2.4
diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/reader/StagingItemReader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/reader/StagingItemReader.java
index 5462fb8f4..d2e3cc9aa 100644
--- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/reader/StagingItemReader.java
+++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/reader/StagingItemReader.java
@@ -18,6 +18,7 @@ import org.springframework.batch.item.ReaderNotOpenException;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.sample.item.writer.StagingItemWriter;
import org.springframework.dao.OptimisticLockingFailureException;
+import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.jdbc.support.lob.DefaultLobHandler;
@@ -107,7 +108,7 @@ public class StagingItemReader extends JdbcDaoSupport implements ItemStream,
}
@SuppressWarnings("unchecked")
- public T read() throws Exception {
+ public T read() throws DataAccessException {
Long id = doRead();
if (id == null) {
diff --git a/spring-batch-samples/src/test/resources/org/springframework/batch/sample/item/writer/staging-test-context.xml b/spring-batch-samples/src/main/resources/staging-test-context.xml
similarity index 97%
rename from spring-batch-samples/src/test/resources/org/springframework/batch/sample/item/writer/staging-test-context.xml
rename to spring-batch-samples/src/main/resources/staging-test-context.xml
index d9c63b1f6..91c507605 100644
--- a/spring-batch-samples/src/test/resources/org/springframework/batch/sample/item/writer/staging-test-context.xml
+++ b/spring-batch-samples/src/main/resources/staging-test-context.xml
@@ -1,26 +1,26 @@
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/reader/GeneratingItemReaderTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/reader/GeneratingItemReaderTests.java
index bf088c8b1..ce50717e3 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/reader/GeneratingItemReaderTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/reader/GeneratingItemReaderTests.java
@@ -1,13 +1,14 @@
package org.springframework.batch.sample.item.reader;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
/**
* Tests for {@link GeneratingItemReader}.
*
* @author Robert Kasanicky
*/
-public class GeneratingItemReaderTests extends TestCase {
+public class GeneratingItemReaderTests {
private GeneratingItemReader reader = new GeneratingItemReader();
@@ -15,6 +16,7 @@ public class GeneratingItemReaderTests extends TestCase {
* Generates a given number of not-null records,
* consecutive calls return null.
*/
+ @Test
public void testRead() throws Exception {
int counter = 0;
int limit = 10;
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/reader/OrderItemReaderTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/reader/OrderItemReaderTests.java
index 619a14737..2423f113c 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/reader/OrderItemReaderTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/reader/OrderItemReaderTests.java
@@ -1,10 +1,11 @@
package org.springframework.batch.sample.item.reader;
+import static org.junit.Assert.*;
+
+import static org.easymock.EasyMock.*;
+
import java.util.Iterator;
-import junit.framework.TestCase;
-
-import org.easymock.MockControl;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.file.mapping.DefaultFieldSet;
import org.springframework.batch.item.file.mapping.FieldSet;
@@ -15,25 +16,20 @@ import org.springframework.batch.sample.domain.Customer;
import org.springframework.batch.sample.domain.LineItem;
import org.springframework.batch.sample.domain.Order;
import org.springframework.batch.sample.domain.ShippingInfo;
+import org.junit.Before;
+import org.junit.Test;
-public class OrderItemReaderTests extends TestCase {
+public class OrderItemReaderTests {
private OrderItemReader provider;
- private MockControl inputControl;
-
private ItemReader