mirror of
https://github.com/google/nomulus
synced 2026-09-20 15:04:24 +00:00
Remove unnecessary Objects.equals() call on collections
This fixes a bug where collections of incompatible types are being tested for equality to each other (e.g.: Set<Foo> equals Set<Integer> should never return true unless both sets are empty, a bit of a vacuous assertion).
This change is necessary to unblock future improvements to the static analysis capabilities of the java compiler.
Tested:
TAP --sample for global presubmit queue
[]
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178798071
This commit is contained in:
@@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
import static com.google.common.truth.Truth.assertAbout;
|
import static com.google.common.truth.Truth.assertAbout;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.truth.FailureMetadata;
|
import com.google.common.truth.FailureMetadata;
|
||||||
import com.google.common.truth.SimpleSubjectBuilder;
|
import com.google.common.truth.SimpleSubjectBuilder;
|
||||||
import google.registry.model.domain.DomainApplication;
|
import google.registry.model.domain.DomainApplication;
|
||||||
@@ -58,13 +57,11 @@ public final class DomainApplicationSubject
|
|||||||
|
|
||||||
public And<DomainApplicationSubject> hasExactlyEncodedSignedMarks(
|
public And<DomainApplicationSubject> hasExactlyEncodedSignedMarks(
|
||||||
EncodedSignedMark... encodedSignedMarks) {
|
EncodedSignedMark... encodedSignedMarks) {
|
||||||
if (!Objects.equals(
|
|
||||||
ImmutableSet.copyOf(actual().getEncodedSignedMarks()),
|
assertThat(actual().getEncodedSignedMarks())
|
||||||
ImmutableSet.of(encodedSignedMarks))) {
|
.named("the encoded signed marks of " + actualAsString())
|
||||||
assertThat(actual().getEncodedSignedMarks())
|
.containsExactly((Object[]) encodedSignedMarks);
|
||||||
.named("the encoded signed marks of " + actualAsString())
|
|
||||||
.containsExactly((Object[]) encodedSignedMarks);
|
|
||||||
}
|
|
||||||
return andChainer();
|
return andChainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user