mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-24 13:02:13 +00:00
Changed no-arg constructor to a form more suitable for unit testing. Also added an equals() method.
This commit is contained in:
parent
dcf78213a3
commit
22b8be49f0
@ -15,9 +15,9 @@
|
||||
|
||||
package net.sf.acegisecurity;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
/**
|
||||
@ -36,7 +36,7 @@ import java.util.Set;
|
||||
public class ConfigAttributeDefinition {
|
||||
//~ Instance fields ========================================================
|
||||
|
||||
private Set configAttributes = new HashSet();
|
||||
private List configAttributes = new Vector();
|
||||
|
||||
//~ Constructors ===========================================================
|
||||
|
||||
@ -64,6 +64,34 @@ public class ConfigAttributeDefinition {
|
||||
this.configAttributes.add(newConfigAttribute);
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof ConfigAttributeDefinition) {
|
||||
ConfigAttributeDefinition test = (ConfigAttributeDefinition) obj;
|
||||
|
||||
List testAttrs = new Vector();
|
||||
Iterator iter = test.getConfigAttributes();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
ConfigAttribute attr = (ConfigAttribute) iter.next();
|
||||
testAttrs.add(attr);
|
||||
}
|
||||
|
||||
if (this.configAttributes.size() != testAttrs.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.configAttributes.size(); i++) {
|
||||
if (!this.configAttributes.get(i).equals(testAttrs.get(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.configAttributes.toString();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user