Fix @VisibleForTesting given the newly deployed enforcement

Generated code is now also covered by @VisibleForTesting, including Dagger @Inject

This CL is a cleanup of auto-generated code by ghm@ from the Error Prone team

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=228748874
This commit is contained in:
guyben 2019-01-10 11:48:28 -08:00 committed by Ben McIlwain
parent 8bde7285bf
commit c74ffd7559
15 changed files with 11 additions and 24 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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<Integer> mapShards,
@Parameter(PARAM_REDUCE_SHARDS) Optional<Integer> reduceShards) {

View file

@ -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<Disclose> {
public Builder setNames(ImmutableList<PostalInfoChoice> names) {
getInstance().name = names;

View file

@ -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<ContactResource> contact) {
DesignatedContact instance = new DesignatedContact();
instance.type = type;

View file

@ -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();

View file

@ -100,7 +100,6 @@ public class Address extends ImmutableObject implements Jsonifiable {
}
/** A builder for constructing {@link Address}. */
@VisibleForTesting
public static class Builder<T extends Address> extends Buildable.Builder<T> {
public Builder() {}

View file

@ -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<T extends PhoneNumber> extends Buildable.Builder<T> {
@Override
public T build() {

View file

@ -129,6 +129,14 @@ public abstract class PollMessage extends ImmutableObject
super(instance);
}
/**
* Manually set the ID for testing or in special circumstances.
*
* <p>In general the ID is auto-created, and there should be no need to set it manually.
*
* <p>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();

View file

@ -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);
}

View file

@ -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<String> SAFE_METHODS = ImmutableSet.of("GET", "HEAD");
@VisibleForTesting
@Inject
public LegacyAuthenticationMechanism(UserService userService, XsrfTokenManager xsrfTokenManager) {
this.userService = userService;

View file

@ -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<String> allowedOauthClientIds;
@VisibleForTesting
@Inject
public OAuthAuthenticationMechanism(
OAuthService oauthService,

View file

@ -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,

View file

@ -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 =

View file

@ -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<Object> 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);
}