From cf4a2832a9ef9a0e9b2b30a26919b88ee9880345 Mon Sep 17 00:00:00 2001 From: dsyer Date: Wed, 12 Dec 2007 13:05:07 +0000 Subject: [PATCH] Fix broken test with existing running job. --- .../execution/repository/SimpleJobRepositoryTests.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java index 8be90e01b..9ce328840 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java @@ -16,8 +16,8 @@ package org.springframework.batch.execution.repository; +import java.sql.Timestamp; import java.util.ArrayList; -import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -170,13 +170,17 @@ public class SimpleJobRepositoryTests extends TestCase { jobDaoControl.setReturnValue(1); jobDao.findJobExecutions(databaseJob); final List executions = new ArrayList(); + JobExecution execution =databaseJob.createNewJobExecution(); + executions.add(execution); + // For this test it is important that the execution is finished + // and the executions in the list contain one with an end date + execution.setEndTime(new Timestamp(System.currentTimeMillis())); jobDaoControl.setReturnValue(executions); jobDao.update(databaseJob); jobDao.save(new JobExecution(databaseJob)); jobDaoControl.setMatcher(new ArgumentsMatcher(){ public boolean matches(Object[] expected, Object[] actual) { JobExecution execution = (JobExecution) actual[0]; - executions.add(execution); return execution.getJob().equals(databaseJob); } public String toString(Object[] arguments) {