Fix for Batch-123:SimpleJobIdentifier does not implement equals/hashcode.

This commit is contained in:
lucasward
2007-09-05 04:00:27 +00:00
parent 351fd5060a
commit 570a86ee6d
2 changed files with 14 additions and 0 deletions

View File

@@ -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);
}
}

View File

@@ -52,4 +52,8 @@ public class SimpleJobIdentifierTests extends TestCase {
.indexOf("name=") >= 0);
}
public void testEquals(){
SimpleJobIdentifier testIdentifier = new SimpleJobIdentifier("foo");
assertEquals(testIdentifier,identifier);
}
}