From 220f7589f59935868926c3c8bf49972408489df0 Mon Sep 17 00:00:00 2001 From: cpovirk Date: Wed, 14 Feb 2018 05:10:31 -0800 Subject: [PATCH] Mark actualCustomStringRepresentation() as @ForOverride. The intention (from []is: - actualAsString() is the method that people call. - actualCustomStringRepresentation() is the method that people override. Fortunately, no one actually calls actualCustomStringRepresentation(), aside from some tests that call it to test a subject's implementation. That's easy enough to work around by extracting a method. (Arguably @ForOverride should permit calls from tests in some cases (now that Error Prone knows how to identify test code). But it's not entirely clear, since, e.g., people shouldn't be testing Converter.doForward(null) because the method can never be invoked that way. Some discussion here: []Tested: global TAP [] RELNOTES=Marked `actualCustomStringRepresentation()` as `@ForOverride`. To retrieve the string representation, call `actualAsString()`. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=185672328 --- .../google/registry/testing/AbstractEppResourceSubject.java | 2 +- javatests/google/registry/testing/HistoryEntrySubject.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/javatests/google/registry/testing/AbstractEppResourceSubject.java b/javatests/google/registry/testing/AbstractEppResourceSubject.java index b5d8d9866..79cb666d6 100644 --- a/javatests/google/registry/testing/AbstractEppResourceSubject.java +++ b/javatests/google/registry/testing/AbstractEppResourceSubject.java @@ -53,7 +53,7 @@ abstract class AbstractEppResourceSubject } @Override - public String actualCustomStringRepresentation() { + protected String actualCustomStringRepresentation() { return String.format( "%s with foreign key '%s'", actual().getClass().getSimpleName(), diff --git a/javatests/google/registry/testing/HistoryEntrySubject.java b/javatests/google/registry/testing/HistoryEntrySubject.java index 41b0a17f8..419cb23a6 100644 --- a/javatests/google/registry/testing/HistoryEntrySubject.java +++ b/javatests/google/registry/testing/HistoryEntrySubject.java @@ -35,7 +35,7 @@ public class HistoryEntrySubject extends Subject