RESOLVED - BATCH-1650: Override GroupAwareJob#toString method

This commit is contained in:
robokaso
2010-11-08 13:33:49 +00:00
parent 362bd5648c
commit 1274bea113
2 changed files with 11 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParametersIncrementer;
import org.springframework.batch.core.JobParametersValidator;
import org.springframework.util.ClassUtils;
/**
* A {@link Job} that can optionally prepend a group name to another job's name,
@@ -114,5 +115,10 @@ public class GroupAwareJob implements Job {
public int hashCode() {
return delegate.hashCode();
}
@Override
public String toString() {
return ClassUtils.getShortName(delegate.getClass()) + ": [name=" + getName() + "]";
}
}

View File

@@ -41,4 +41,9 @@ public class GroupAwareJobTests {
assertEquals("jobs.foo", result.getName());
}
@Test
public void testToString() {
GroupAwareJob result = new GroupAwareJob("jobs", job);
assertEquals("JobSupport: [name=jobs.foo]", result.toString());
}
}