Adding an equals method for KeyValuePair for easier testing.
With this we can write stuff like assertThat(result.mandatory, hasItem(new KeyValuePair("minWidth", "1280"))); The above will currently fail because the object falls back to ==. BUG=None Review URL: https://codereview.webrtc.org/1193883006 Cr-Commit-Position: refs/heads/master@{#9494}
This commit is contained in:
parent
66f920ea57
commit
7ab5f801dd
@ -56,8 +56,24 @@ public class MediaConstraints {
|
||||
public String toString() {
|
||||
return key + ": " + value;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (other == null || getClass() != other.getClass()) {
|
||||
return false;
|
||||
}
|
||||
KeyValuePair that = (KeyValuePair)other;
|
||||
return key.equals(that.key) && value.equals(that.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return key.hashCode() + value.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public final List<KeyValuePair> mandatory;
|
||||
public final List<KeyValuePair> optional;
|
||||
|
Loading…
Reference in New Issue
Block a user