Fix for Batch-123:SimpleJobIdentifier does not implement equals/hashcode.
This commit is contained in:
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.springframework.batch.core.runtime;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -62,4 +65,11 @@ public class SimpleJobIdentifier implements JobIdentifier {
|
||||
return "name=" + name;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return EqualsBuilder.reflectionEquals(this, obj);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,4 +52,8 @@ public class SimpleJobIdentifierTests extends TestCase {
|
||||
.indexOf("name=") >= 0);
|
||||
}
|
||||
|
||||
public void testEquals(){
|
||||
SimpleJobIdentifier testIdentifier = new SimpleJobIdentifier("foo");
|
||||
assertEquals(testIdentifier,identifier);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user