mirror of
https://github.com/google/nomulus
synced 2026-01-08 15:21:46 +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.assertThat;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.truth.FailureMetadata;
|
||||
import com.google.common.truth.SimpleSubjectBuilder;
|
||||
import google.registry.model.domain.DomainApplication;
|
||||
@@ -58,13 +57,11 @@ public final class DomainApplicationSubject
|
||||
|
||||
public And<DomainApplicationSubject> hasExactlyEncodedSignedMarks(
|
||||
EncodedSignedMark... encodedSignedMarks) {
|
||||
if (!Objects.equals(
|
||||
ImmutableSet.copyOf(actual().getEncodedSignedMarks()),
|
||||
ImmutableSet.of(encodedSignedMarks))) {
|
||||
assertThat(actual().getEncodedSignedMarks())
|
||||
.named("the encoded signed marks of " + actualAsString())
|
||||
.containsExactly((Object[]) encodedSignedMarks);
|
||||
}
|
||||
|
||||
assertThat(actual().getEncodedSignedMarks())
|
||||
.named("the encoded signed marks of " + actualAsString())
|
||||
.containsExactly((Object[]) encodedSignedMarks);
|
||||
|
||||
return andChainer();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user