From 08b068b7bf2eebe9aef64796d53a306f44527add Mon Sep 17 00:00:00 2001 From: glorioso Date: Tue, 12 Dec 2017 12:28:46 -0800 Subject: [PATCH] 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 equals Set 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 --- .../registry/testing/DomainApplicationSubject.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/javatests/google/registry/testing/DomainApplicationSubject.java b/javatests/google/registry/testing/DomainApplicationSubject.java index 0e9a80ecd..82acf998c 100644 --- a/javatests/google/registry/testing/DomainApplicationSubject.java +++ b/javatests/google/registry/testing/DomainApplicationSubject.java @@ -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 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(); }