RESOLVED - BATCH-1650: Override GroupAwareJob#toString method
This commit is contained in:
@@ -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() + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user