Add tests for LabelNormalizer
These use the full InMemoryModule stack because depending on users, groups, label types, and permissions is heavyweight. The careful reader will notice based on the tested behavior that there are still some outstanding bugs in label normalization during submit time. For example, since Submit only upserts the normalized list of approvals, any labels omitted by the normalizer due to an empty permission range are left entirely untouched. Such bugs are not fixed by this change, which is only to add tests. Change-Id: I955ee8c63b17812684f8350113cb0f2f1bf72fe6
This commit is contained in:
@@ -19,6 +19,7 @@ import com.google.gwtorm.client.CompoundKey;
|
||||
import com.google.gwtorm.client.StringKey;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Objects;
|
||||
|
||||
/** An approval (or negative approval) on a patch set. */
|
||||
public final class PatchSetApproval {
|
||||
@@ -190,4 +191,20 @@ public final class PatchSetApproval {
|
||||
return new StringBuilder().append('[').append(key).append(": ")
|
||||
.append(value).append(']').toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof PatchSetApproval) {
|
||||
PatchSetApproval p = (PatchSetApproval) o;
|
||||
return Objects.equals(key, p.key)
|
||||
&& Objects.equals(value, p.value)
|
||||
&& Objects.equals(granted, p.granted);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(key, value, granted);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user