diff --git a/java/google/registry/batch/AsyncTaskEnqueuer.java b/java/google/registry/batch/AsyncTaskEnqueuer.java index 85091bca5..7cd94e2b4 100644 --- a/java/google/registry/batch/AsyncTaskEnqueuer.java +++ b/java/google/registry/batch/AsyncTaskEnqueuer.java @@ -21,7 +21,6 @@ import com.google.appengine.api.taskqueue.Queue; import com.google.appengine.api.taskqueue.TaskOptions; import com.google.appengine.api.taskqueue.TaskOptions.Method; import com.google.appengine.api.taskqueue.TransientFailureException; -import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; import com.google.common.collect.ImmutableSortedSet; import com.google.common.flogger.FluentLogger; @@ -68,7 +67,6 @@ public final class AsyncTaskEnqueuer { private final AppEngineServiceUtils appEngineServiceUtils; private final Retrier retrier; - @VisibleForTesting @Inject public AsyncTaskEnqueuer( @Named(QUEUE_ASYNC_ACTIONS) Queue asyncActionsPushQueue, diff --git a/java/google/registry/flows/TlsCredentials.java b/java/google/registry/flows/TlsCredentials.java index 455123e27..efd949322 100644 --- a/java/google/registry/flows/TlsCredentials.java +++ b/java/google/registry/flows/TlsCredentials.java @@ -60,7 +60,6 @@ public class TlsCredentials implements TransportCredentials { private final InetAddress clientInetAddr; @Inject - @VisibleForTesting public TlsCredentials( @Config("requireSslCertificates") boolean requireSslCertificates, @Header("X-SSL-Certificate") String clientCertificateHash, diff --git a/java/google/registry/mapreduce/MapreduceRunner.java b/java/google/registry/mapreduce/MapreduceRunner.java index 58e2fff27..012522a99 100644 --- a/java/google/registry/mapreduce/MapreduceRunner.java +++ b/java/google/registry/mapreduce/MapreduceRunner.java @@ -32,7 +32,6 @@ import com.google.appengine.tools.mapreduce.Reducer; import com.google.appengine.tools.mapreduce.outputs.NoOutput; import com.google.appengine.tools.pipeline.Job0; import com.google.appengine.tools.pipeline.JobSetting; -import com.google.common.annotations.VisibleForTesting; import com.google.common.flogger.FluentLogger; import google.registry.mapreduce.inputs.ConcatenatingInput; import google.registry.request.Parameter; @@ -86,7 +85,6 @@ public class MapreduceRunner { * @param reduceShards number of reduce shards; if omitted, uses {@link #defaultReduceShards} */ @Inject - @VisibleForTesting public MapreduceRunner( @Parameter(PARAM_MAP_SHARDS) Optional mapShards, @Parameter(PARAM_REDUCE_SHARDS) Optional reduceShards) { diff --git a/java/google/registry/model/contact/Disclose.java b/java/google/registry/model/contact/Disclose.java index c7c0cc168..f907b5f05 100644 --- a/java/google/registry/model/contact/Disclose.java +++ b/java/google/registry/model/contact/Disclose.java @@ -16,7 +16,6 @@ package google.registry.model.contact; import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy; -import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableList; import com.googlecode.objectify.annotation.Embed; import google.registry.model.Buildable; @@ -84,7 +83,6 @@ public class Disclose extends ImmutableObject { return type; } - @VisibleForTesting public static PostalInfoChoice create(PostalInfo.Type type) { PostalInfoChoice instance = new PostalInfoChoice(); instance.type = type; @@ -93,7 +91,6 @@ public class Disclose extends ImmutableObject { } /** A builder for {@link Disclose} since it is immutable. */ - @VisibleForTesting public static class Builder extends Buildable.Builder { public Builder setNames(ImmutableList names) { getInstance().name = names; diff --git a/java/google/registry/model/domain/DesignatedContact.java b/java/google/registry/model/domain/DesignatedContact.java index b95e42401..cf71f25af 100644 --- a/java/google/registry/model/domain/DesignatedContact.java +++ b/java/google/registry/model/domain/DesignatedContact.java @@ -16,7 +16,6 @@ package google.registry.model.domain; import static google.registry.util.PreconditionsUtils.checkArgumentNotNull; -import com.google.common.annotations.VisibleForTesting; import com.googlecode.objectify.Key; import com.googlecode.objectify.annotation.Embed; import com.googlecode.objectify.annotation.Index; @@ -57,7 +56,6 @@ public class DesignatedContact extends ImmutableObject { REGISTRANT; } - @VisibleForTesting public static DesignatedContact create(Type type, Key contact) { DesignatedContact instance = new DesignatedContact(); instance.type = type; diff --git a/java/google/registry/model/domain/secdns/DelegationSignerData.java b/java/google/registry/model/domain/secdns/DelegationSignerData.java index 8b6e8e14d..7c0926234 100644 --- a/java/google/registry/model/domain/secdns/DelegationSignerData.java +++ b/java/google/registry/model/domain/secdns/DelegationSignerData.java @@ -14,7 +14,6 @@ package google.registry.model.domain.secdns; -import com.google.common.annotations.VisibleForTesting; import com.googlecode.objectify.annotation.Embed; import google.registry.model.ImmutableObject; import javax.xml.bind.DatatypeConverter; @@ -76,7 +75,6 @@ public class DelegationSignerData return digest; } - @VisibleForTesting public static DelegationSignerData create( int keyTag, int algorithm, int digestType, byte[] digest) { DelegationSignerData instance = new DelegationSignerData(); diff --git a/java/google/registry/model/eppcommon/Address.java b/java/google/registry/model/eppcommon/Address.java index c7b3ef6ad..03380f789 100644 --- a/java/google/registry/model/eppcommon/Address.java +++ b/java/google/registry/model/eppcommon/Address.java @@ -100,7 +100,6 @@ public class Address extends ImmutableObject implements Jsonifiable { } /** A builder for constructing {@link Address}. */ - @VisibleForTesting public static class Builder extends Buildable.Builder { public Builder() {} diff --git a/java/google/registry/model/eppcommon/PhoneNumber.java b/java/google/registry/model/eppcommon/PhoneNumber.java index deb1bfaad..56e332d99 100644 --- a/java/google/registry/model/eppcommon/PhoneNumber.java +++ b/java/google/registry/model/eppcommon/PhoneNumber.java @@ -16,7 +16,6 @@ package google.registry.model.eppcommon; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.VisibleForTesting; import google.registry.model.Buildable; import google.registry.model.ImmutableObject; import javax.xml.bind.annotation.XmlAttribute; @@ -66,7 +65,6 @@ public class PhoneNumber extends ImmutableObject { } /** A builder for constructing {@link PhoneNumber}. */ - @VisibleForTesting public static class Builder extends Buildable.Builder { @Override public T build() { diff --git a/java/google/registry/model/poll/PollMessage.java b/java/google/registry/model/poll/PollMessage.java index d9eff4a6e..e06de046a 100644 --- a/java/google/registry/model/poll/PollMessage.java +++ b/java/google/registry/model/poll/PollMessage.java @@ -129,6 +129,14 @@ public abstract class PollMessage extends ImmutableObject super(instance); } + /** + * Manually set the ID for testing or in special circumstances. + * + *

In general the ID is auto-created, and there should be no need to set it manually. + * + *

This is only here for testing and for one special situation in which we're making a new + * poll message to replace an existing one, so it has to have the same ID. + */ public B setId(Long id) { getInstance().id = id; return thisCastToDerived(); diff --git a/java/google/registry/model/registry/Registry.java b/java/google/registry/model/registry/Registry.java index 647ece16e..235157cc7 100644 --- a/java/google/registry/model/registry/Registry.java +++ b/java/google/registry/model/registry/Registry.java @@ -562,7 +562,6 @@ public class Registry extends ImmutableObject implements Buildable { * domain renewal, and all derived costs (i.e. autorenews, transfers, and the per-domain part of a * restore cost). */ - @VisibleForTesting public Money getStandardRenewCost(DateTime now) { return renewBillingCostTransitions.getValueAtTime(now); } diff --git a/java/google/registry/request/auth/LegacyAuthenticationMechanism.java b/java/google/registry/request/auth/LegacyAuthenticationMechanism.java index a33018af8..b4f12eab0 100644 --- a/java/google/registry/request/auth/LegacyAuthenticationMechanism.java +++ b/java/google/registry/request/auth/LegacyAuthenticationMechanism.java @@ -22,7 +22,6 @@ import static google.registry.security.XsrfTokenManager.P_CSRF_TOKEN; import static google.registry.security.XsrfTokenManager.X_CSRF_TOKEN; import com.google.appengine.api.users.UserService; -import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableSet; import google.registry.security.XsrfTokenManager; import javax.inject.Inject; @@ -41,7 +40,6 @@ public class LegacyAuthenticationMechanism implements AuthenticationMechanism { /** HTTP methods which are considered safe, and do not require XSRF protection. */ private static final ImmutableSet SAFE_METHODS = ImmutableSet.of("GET", "HEAD"); - @VisibleForTesting @Inject public LegacyAuthenticationMechanism(UserService userService, XsrfTokenManager xsrfTokenManager) { this.userService = userService; diff --git a/java/google/registry/request/auth/OAuthAuthenticationMechanism.java b/java/google/registry/request/auth/OAuthAuthenticationMechanism.java index e9e34d2df..d9bb816cd 100644 --- a/java/google/registry/request/auth/OAuthAuthenticationMechanism.java +++ b/java/google/registry/request/auth/OAuthAuthenticationMechanism.java @@ -22,7 +22,6 @@ import com.google.appengine.api.oauth.OAuthRequestException; import com.google.appengine.api.oauth.OAuthService; import com.google.appengine.api.oauth.OAuthServiceFailureException; import com.google.appengine.api.users.User; -import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableSet; import com.google.common.flogger.FluentLogger; import google.registry.config.RegistryConfig.Config; @@ -50,7 +49,6 @@ public class OAuthAuthenticationMechanism implements AuthenticationMechanism { private final ImmutableSet allowedOauthClientIds; - @VisibleForTesting @Inject public OAuthAuthenticationMechanism( OAuthService oauthService, diff --git a/java/google/registry/request/auth/RequestAuthenticator.java b/java/google/registry/request/auth/RequestAuthenticator.java index 97f177f9c..4d1f8c72e 100644 --- a/java/google/registry/request/auth/RequestAuthenticator.java +++ b/java/google/registry/request/auth/RequestAuthenticator.java @@ -17,7 +17,6 @@ package google.registry.request.auth; import static com.google.common.base.Preconditions.checkArgument; import com.google.auto.value.AutoValue; -import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableList; import com.google.common.collect.Ordering; import com.google.common.flogger.FluentLogger; @@ -35,7 +34,6 @@ public class RequestAuthenticator { private static final FluentLogger logger = FluentLogger.forEnclosingClass(); - @VisibleForTesting @Inject public RequestAuthenticator( AppEngineInternalAuthenticationMechanism appEngineInternalAuthenticationMechanism, diff --git a/java/google/registry/tools/ShellCommand.java b/java/google/registry/tools/ShellCommand.java index 8c57bb329..7292fbcfa 100644 --- a/java/google/registry/tools/ShellCommand.java +++ b/java/google/registry/tools/ShellCommand.java @@ -297,7 +297,6 @@ public class ShellCommand implements Command { return resultBuilder.build().toArray(new String[0]); } - @VisibleForTesting static class JCommanderCompletor implements Completor { private static final ParamDoc DEFAULT_PARAM_DOC = diff --git a/java/google/registry/ui/forms/FormFieldException.java b/java/google/registry/ui/forms/FormFieldException.java index 183e66087..a42e439f4 100644 --- a/java/google/registry/ui/forms/FormFieldException.java +++ b/java/google/registry/ui/forms/FormFieldException.java @@ -19,6 +19,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; import com.google.common.annotations.VisibleForTesting; +import com.google.common.annotations.VisibleForTesting.Visibility; import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.Iterator; @@ -47,6 +48,7 @@ import javax.annotation.concurrent.NotThreadSafe; * oftentimes will not know the name of the field they're validating. */ @NotThreadSafe +@SuppressWarnings("OverrideThrowableToString") public final class FormFieldException extends FormException { private final List names = new ArrayList<>(); @@ -131,7 +133,7 @@ public final class FormFieldException extends FormException { /** Returns self with {@code name} prepended, for propagating exceptions up the stack. */ @CheckReturnValue - @VisibleForTesting + @VisibleForTesting(productionVisibility = Visibility.PACKAGE_PRIVATE) public FormFieldException propagate(String name) { return propagateImpl(name); }