From ec8156833f32d808ecc875ab8e10ddbc471e60a2 Mon Sep 17 00:00:00 2001 From: svc-excavator-bot Date: Thu, 10 Oct 2019 16:09:58 +0000 Subject: [PATCH] Excavator: Upgrades Baseline to the latest version --- .baseline/checkstyle/checkstyle.xml | 8 +++--- .baseline/spotless/eclipse.xml | 1 + build.gradle | 2 +- .../config/KeepAliveSslSocketFactory.java | 1 + .../config/ClientConfigurationsTest.java | 2 +- .../java/serialization/ObjectMappersTest.java | 2 +- .../NeverRetryingBackoffStrategy.java | 2 +- .../PathTemplateHeaderEnrichmentContract.java | 2 +- .../feignimpl/PathTemplateHeaderRewriter.java | 2 +- .../feignimpl/SlashEncodingContract.java | 2 +- .../jaxrs/JaxRsClientConfigRefreshTest.java | 4 +-- .../jaxrs/JaxRsClientProxyConfigTest.java | 4 +-- .../conjure/java/client/jaxrs/TracerTest.java | 4 +-- .../GuavaOptionalAwareDecoderTest.java | 2 +- .../jaxrs/feignimpl/GuavaTestServer.java | 2 +- .../Java8OptionalAwareDecoderTest.java | 2 +- .../jaxrs/feignimpl/Java8TestServer.java | 4 +-- .../jaxrs/feignimpl/ServiceConfigTest.java | 2 +- .../feignimpl/SlashEncodingContractTest.java | 2 +- .../server/jersey/ExceptionMappingTest.java | 6 ++--- ...ncSerializableErrorCallAdapterFactory.java | 10 +++---- ...ptionalObjectToStringConverterFactory.java | 2 +- .../retrofit2/Retrofit2ClientApiTest.java | 4 +-- .../Retrofit2ClientConfigRefreshTest.java | 4 +-- .../Retrofit2ClientFailoverTest.java | 12 ++++----- .../retrofit2/Retrofit2ClientProxyTest.java | 4 +-- .../server/AutoDeserializeTest.java | 5 ++-- .../undertest/ServerUnderTestApplication.java | 4 +-- .../java/config/ssl/KeyStoresTests.java | 6 ++--- .../config/ssl/pkcs1/Pkcs1ReadersTests.java | 2 +- .../conjure/java/okhttp/HostMetricsTest.java | 2 +- .../okhttp/InstrumentedInterceptorTest.java | 2 +- .../conjure/java/okhttp/LeakDetectorTest.java | 2 +- .../java/okhttp/OkHttpClientsTest.java | 26 +++++++++---------- 34 files changed, 73 insertions(+), 68 deletions(-) diff --git a/.baseline/checkstyle/checkstyle.xml b/.baseline/checkstyle/checkstyle.xml index f541b63e24..43ec38a3aa 100644 --- a/.baseline/checkstyle/checkstyle.xml +++ b/.baseline/checkstyle/checkstyle.xml @@ -84,11 +84,13 @@ + org.apache.commons.lang3.Validate.*, + org.assertj.core.api.Assertions.*, + org.mockito.Mockito.*"/> diff --git a/.baseline/spotless/eclipse.xml b/.baseline/spotless/eclipse.xml index 7bf7de7871..fe1fc71ea7 100644 --- a/.baseline/spotless/eclipse.xml +++ b/.baseline/spotless/eclipse.xml @@ -92,6 +92,7 @@ + diff --git a/build.gradle b/build.gradle index 53ac484927..3eafb09e6f 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' classpath 'com.netflix.nebula:gradle-dependency-lock-plugin:7.0.1' classpath 'com.netflix.nebula:nebula-publishing-plugin:14.0.0' - classpath 'com.palantir.baseline:gradle-baseline-java:2.7.0' + classpath 'com.palantir.baseline:gradle-baseline-java:2.19.0' classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.12.2' classpath 'gradle.plugin.org.inferred:gradle-processors:3.1.0' classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:1.12.4' diff --git a/client-config/src/main/java/com/palantir/conjure/java/client/config/KeepAliveSslSocketFactory.java b/client-config/src/main/java/com/palantir/conjure/java/client/config/KeepAliveSslSocketFactory.java index 92b709f7de..04d392ec99 100644 --- a/client-config/src/main/java/com/palantir/conjure/java/client/config/KeepAliveSslSocketFactory.java +++ b/client-config/src/main/java/com/palantir/conjure/java/client/config/KeepAliveSslSocketFactory.java @@ -46,6 +46,7 @@ Socket wrap(Socket socket) throws SocketException { return socket; } + @Override public String toString() { return "KeepAliveSslSocketFactory{delegate=" + delegate + '}'; } diff --git a/client-config/src/test/java/com/palantir/conjure/java/client/config/ClientConfigurationsTest.java b/client-config/src/test/java/com/palantir/conjure/java/client/config/ClientConfigurationsTest.java index 9fbe575bad..f7e3bb6d12 100644 --- a/client-config/src/test/java/com/palantir/conjure/java/client/config/ClientConfigurationsTest.java +++ b/client-config/src/test/java/com/palantir/conjure/java/client/config/ClientConfigurationsTest.java @@ -101,7 +101,7 @@ public void meshProxy_maxRetriesMustBe0() throws Exception { ClientConfiguration validConfig = ClientConfigurations.of(meshProxyServiceConfig(uris, 0)); assertThat(validConfig.meshProxy()).isEqualTo(Optional.of(HostAndPort.fromParts("localhost", 1234))); - assertThat(validConfig.maxNumRetries()).isEqualTo(0); + assertThat(validConfig.maxNumRetries()).isZero(); } @Test diff --git a/conjure-java-jackson-serialization/src/test/java/com/palantir/conjure/java/serialization/ObjectMappersTest.java b/conjure-java-jackson-serialization/src/test/java/com/palantir/conjure/java/serialization/ObjectMappersTest.java index dcba63720a..714e3e5e33 100644 --- a/conjure-java-jackson-serialization/src/test/java/com/palantir/conjure/java/serialization/ObjectMappersTest.java +++ b/conjure-java-jackson-serialization/src/test/java/com/palantir/conjure/java/serialization/ObjectMappersTest.java @@ -66,7 +66,7 @@ public void deserializeJdk8ModulePresentOptional() throws IOException { @Test public void deserializeJdk8ModuleAbsentOptional() throws IOException { - assertThat(MAPPER.readValue("null", Optional.class)).isEqualTo(Optional.empty()); + assertThat(MAPPER.readValue("null", Optional.class)).isNotPresent(); } @Test diff --git a/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/NeverRetryingBackoffStrategy.java b/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/NeverRetryingBackoffStrategy.java index ed3909941b..c66ade0ba7 100644 --- a/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/NeverRetryingBackoffStrategy.java +++ b/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/NeverRetryingBackoffStrategy.java @@ -23,7 +23,7 @@ public enum NeverRetryingBackoffStrategy implements BackoffStrategy { INSTANCE; @Override - public boolean backoff(int numFailedAttempts) { + public boolean backoff(int _numFailedAttempts) { return false; } } diff --git a/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/PathTemplateHeaderEnrichmentContract.java b/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/PathTemplateHeaderEnrichmentContract.java index 9e567c122d..25c6460fa0 100644 --- a/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/PathTemplateHeaderEnrichmentContract.java +++ b/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/PathTemplateHeaderEnrichmentContract.java @@ -28,7 +28,7 @@ public PathTemplateHeaderEnrichmentContract(Contract delegate) { } @Override - protected void processMetadata(Class targetType, Method method, MethodMetadata metadata) { + protected void processMetadata(Class _targetType, Method _method, MethodMetadata metadata) { metadata.template() .header(OkhttpTraceInterceptor.PATH_TEMPLATE_HEADER, metadata.template().method() + " " diff --git a/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/PathTemplateHeaderRewriter.java b/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/PathTemplateHeaderRewriter.java index a2840640ef..65d056e1a7 100644 --- a/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/PathTemplateHeaderRewriter.java +++ b/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/PathTemplateHeaderRewriter.java @@ -28,7 +28,7 @@ public enum PathTemplateHeaderRewriter implements RequestInterceptor { INSTANCE; @Override - public void apply(RequestTemplate template) { + public void apply(RequestTemplate _template) { // nop } } diff --git a/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/SlashEncodingContract.java b/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/SlashEncodingContract.java index b02b07d833..eb0597ff80 100644 --- a/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/SlashEncodingContract.java +++ b/conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/feignimpl/SlashEncodingContract.java @@ -30,7 +30,7 @@ public SlashEncodingContract(Contract delegate) { } @Override - protected void processMetadata(Class targetType, Method method, MethodMetadata metadata) { + protected void processMetadata(Class _targetType, Method _method, MethodMetadata metadata) { metadata.template().decodeSlash(false); } } diff --git a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/JaxRsClientConfigRefreshTest.java b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/JaxRsClientConfigRefreshTest.java index 2eff3938e5..aa1a9aa1fd 100644 --- a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/JaxRsClientConfigRefreshTest.java +++ b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/JaxRsClientConfigRefreshTest.java @@ -50,13 +50,13 @@ public void testConfigRefresh() throws Exception { server1.enqueue(new MockResponse().setBody("\"server1\"")); assertThat(proxy.string()).isEqualTo("server1"); assertThat(server1.getRequestCount()).isEqualTo(1); - assertThat(server2.getRequestCount()).isEqualTo(0); + assertThat(server2.getRequestCount()).isZero(); // Call 2 server1.enqueue(new MockResponse().setBody("\"server1\"")); assertThat(proxy.string()).isEqualTo("server1"); assertThat(server1.getRequestCount()).isEqualTo(2); - assertThat(server2.getRequestCount()).isEqualTo(0); + assertThat(server2.getRequestCount()).isZero(); // Switch config refreshableConfig.set(config2); diff --git a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/JaxRsClientProxyConfigTest.java b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/JaxRsClientProxyConfigTest.java index 3d158246c8..7575dcbf9b 100644 --- a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/JaxRsClientProxyConfigTest.java +++ b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/JaxRsClientProxyConfigTest.java @@ -89,13 +89,13 @@ public void testAuthenticatedProxy() throws Exception { private static ProxySelector createProxySelector(String host, int port) { return new ProxySelector() { @Override - public List select(URI uri) { + public List select(URI _uri) { InetSocketAddress addr = new InetSocketAddress(host, port); return ImmutableList.of(new Proxy(Proxy.Type.HTTP, addr)); } @Override - public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {} + public void connectFailed(URI _uri, SocketAddress _sa, IOException _ioe) {} }; } } diff --git a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/TracerTest.java b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/TracerTest.java index 2432bd8118..3643a23428 100644 --- a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/TracerTest.java +++ b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/TracerTest.java @@ -145,12 +145,12 @@ private void runTwoRequestsInParallel() { ExecutorService executor = Executors.newFixedThreadPool(2); CompletableFuture first = CompletableFuture.runAsync(() -> { Tracer.initTrace(Optional.of(true), "first"); - OpenSpan ignored = Tracer.startSpan(""); + Tracer.startSpan(""); service.string(); }, executor); CompletableFuture second = CompletableFuture.runAsync(() -> { Tracer.initTrace(Optional.of(true), "second"); - OpenSpan ignored = Tracer.startSpan(""); + Tracer.startSpan(""); service.string(); }, executor); first.join(); diff --git a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/GuavaOptionalAwareDecoderTest.java b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/GuavaOptionalAwareDecoderTest.java index 22b37b5a02..0a330b45ec 100644 --- a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/GuavaOptionalAwareDecoderTest.java +++ b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/GuavaOptionalAwareDecoderTest.java @@ -66,7 +66,7 @@ public void testOptional() { @Test public void testNonOptional() { assertThat(service.getNonOptional("something")).isEqualTo(ImmutableMap.of("something", "something")); - assertThat(service.getNonOptional(null)).isEqualTo(ImmutableMap.of()); + assertThat(service.getNonOptional(null)).isEmpty(); } @Test diff --git a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/GuavaTestServer.java b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/GuavaTestServer.java index 5986ccd96d..7c6b0253b3 100644 --- a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/GuavaTestServer.java +++ b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/GuavaTestServer.java @@ -43,7 +43,7 @@ public class GuavaTestServer extends Application { @Override - public final void run(Configuration config, final Environment env) throws Exception { + public final void run(Configuration _config, final Environment env) throws Exception { env.jersey().register(ConjureJerseyFeature.INSTANCE); env.jersey().register(new JacksonMessageBodyProvider(ObjectMappers.newServerObjectMapper())); env.jersey().register(new TestResource()); diff --git a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/Java8OptionalAwareDecoderTest.java b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/Java8OptionalAwareDecoderTest.java index d878470155..732a25092b 100644 --- a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/Java8OptionalAwareDecoderTest.java +++ b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/Java8OptionalAwareDecoderTest.java @@ -66,7 +66,7 @@ public void testOptional() { @Test public void testNonOptional() { assertThat(service.getNonOptional("something")).isEqualTo(ImmutableMap.of("something", "something")); - assertThat(service.getNonOptional(null)).isEqualTo(ImmutableMap.of()); + assertThat(service.getNonOptional(null)).isEmpty(); } @Test diff --git a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/Java8TestServer.java b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/Java8TestServer.java index c8b2f84e79..763926abf4 100644 --- a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/Java8TestServer.java +++ b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/Java8TestServer.java @@ -51,7 +51,7 @@ public class Java8TestServer extends Application { @Override - public final void run(Configuration config, final Environment env) throws Exception { + public final void run(Configuration _config, final Environment env) throws Exception { env.jersey().register(ConjureJerseyFeature.INSTANCE); env.jersey().register(new JacksonMessageBodyProvider(ObjectMappers.newServerObjectMapper())); env.jersey().register(new EmptyOptionalTo204ExceptionMapper()); @@ -61,7 +61,7 @@ public final void run(Configuration config, final Environment env) throws Except @Provider private static final class EmptyOptionalTo204ExceptionMapper implements ExceptionMapper { @Override - public Response toResponse(EmptyOptionalException exception) { + public Response toResponse(EmptyOptionalException _exception) { return Response.noContent().build(); } } diff --git a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/ServiceConfigTest.java b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/ServiceConfigTest.java index 03fd51643e..5dee87fb01 100644 --- a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/ServiceConfigTest.java +++ b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/ServiceConfigTest.java @@ -83,7 +83,7 @@ public void initialize(Bootstrap bootstrap) { } @Override - public void run(ServiceConfigTestAppConfig configuration, Environment environment) throws Exception { + public void run(ServiceConfigTestAppConfig _configuration, Environment environment) throws Exception { environment.jersey().register(new Resource()); } diff --git a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/SlashEncodingContractTest.java b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/SlashEncodingContractTest.java index e4a988087d..c95ef708ae 100644 --- a/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/SlashEncodingContractTest.java +++ b/conjure-java-jaxrs-client/src/test/java/com/palantir/conjure/java/client/jaxrs/feignimpl/SlashEncodingContractTest.java @@ -92,7 +92,7 @@ public interface Service { public static class Server extends Application { @Override - public final void run(Configuration config, final Environment env) throws Exception { + public final void run(Configuration _config, final Environment env) throws Exception { env.jersey().register(resource); } } diff --git a/conjure-java-jersey-server/src/test/java/com/palantir/conjure/java/server/jersey/ExceptionMappingTest.java b/conjure-java-jersey-server/src/test/java/com/palantir/conjure/java/server/jersey/ExceptionMappingTest.java index cab8453284..1001b8b8a3 100644 --- a/conjure-java-jersey-server/src/test/java/com/palantir/conjure/java/server/jersey/ExceptionMappingTest.java +++ b/conjure-java-jersey-server/src/test/java/com/palantir/conjure/java/server/jersey/ExceptionMappingTest.java @@ -140,9 +140,9 @@ public void testServiceException() throws IOException { Map rawError = ObjectMappers.newClientObjectMapper().readValue(body, new TypeReference>() {}); - assertThat(rawError.get("errorCode")).isEqualTo(ErrorType.INVALID_ARGUMENT.code().toString()); - assertThat(rawError.get("errorName")).isEqualTo(ErrorType.INVALID_ARGUMENT.name()); - assertThat(rawError.get("parameters")).isEqualTo(ImmutableMap.of("arg", "value")); + assertThat(rawError).containsEntry("errorCode", ErrorType.INVALID_ARGUMENT.code().toString()); + assertThat(rawError).containsEntry("errorName", ErrorType.INVALID_ARGUMENT.name()); + assertThat(rawError).containsEntry("parameters", ImmutableMap.of("arg", "value")); } @Test diff --git a/conjure-java-retrofit2-client/src/main/java/com/palantir/conjure/java/client/retrofit2/AsyncSerializableErrorCallAdapterFactory.java b/conjure-java-retrofit2-client/src/main/java/com/palantir/conjure/java/client/retrofit2/AsyncSerializableErrorCallAdapterFactory.java index d27de51af2..460a8f1717 100644 --- a/conjure-java-retrofit2-client/src/main/java/com/palantir/conjure/java/client/retrofit2/AsyncSerializableErrorCallAdapterFactory.java +++ b/conjure-java-retrofit2-client/src/main/java/com/palantir/conjure/java/client/retrofit2/AsyncSerializableErrorCallAdapterFactory.java @@ -48,7 +48,7 @@ final class AsyncSerializableErrorCallAdapterFactory extends CallAdapter.Factory private AsyncSerializableErrorCallAdapterFactory() {} @Override - public CallAdapter get(Type returnType, Annotation[] annotations, Retrofit retrofit) { + public CallAdapter get(Type returnType, Annotation[] _annotations, Retrofit _retrofit) { Type outerType = getRawType(returnType); if (outerType != CompletableFuture.class && outerType != ListenableFuture.class) { return null; @@ -91,7 +91,7 @@ public boolean cancel(boolean mayInterruptIfRunning) { } @Override - public void onResponse(Call call, Response response) { + public void onResponse(Call _call, Response response) { boolean futureWasCancelled = !set(response.body()); if (futureWasCancelled) { close(response); @@ -99,7 +99,7 @@ public void onResponse(Call call, Response response) { } @Override - public void onFailure(Call call, Throwable throwable) { + public void onFailure(Call _call, Throwable throwable) { // TODO(rfink): Would be good to not leak okhttp internals here if (throwable instanceof IoRemoteException) { setException(((IoRemoteException) throwable).getWrappedException()); @@ -157,7 +157,7 @@ public boolean cancel(boolean mayInterruptIfRunning) { call.enqueue(new Callback() { @Override - public void onResponse(Call call, Response response) { + public void onResponse(Call _call, Response response) { boolean futureWasCancelled = !future.complete(response.body()); if (futureWasCancelled) { close(response); @@ -165,7 +165,7 @@ public void onResponse(Call call, Response response) { } @Override - public void onFailure(Call call, Throwable throwable) { + public void onFailure(Call _call, Throwable throwable) { // TODO(rfink): Would be good to not leak okhttp internals here if (throwable instanceof IoRemoteException) { future.completeExceptionally( diff --git a/conjure-java-retrofit2-client/src/main/java/com/palantir/conjure/java/client/retrofit2/OptionalObjectToStringConverterFactory.java b/conjure-java-retrofit2-client/src/main/java/com/palantir/conjure/java/client/retrofit2/OptionalObjectToStringConverterFactory.java index aacf5d6d98..34b5e497bd 100644 --- a/conjure-java-retrofit2-client/src/main/java/com/palantir/conjure/java/client/retrofit2/OptionalObjectToStringConverterFactory.java +++ b/conjure-java-retrofit2-client/src/main/java/com/palantir/conjure/java/client/retrofit2/OptionalObjectToStringConverterFactory.java @@ -39,7 +39,7 @@ public final class OptionalObjectToStringConverterFactory extends Converter.Fact private OptionalObjectToStringConverterFactory() {} @Override - public Converter stringConverter(Type type, Annotation[] annotations, Retrofit retrofit) { + public Converter stringConverter(Type type, Annotation[] annotations, Retrofit _retrofit) { Optional pathQueryAnnotation = ImmutableList.copyOf(annotations) .stream() .map(Annotation::annotationType) diff --git a/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientApiTest.java b/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientApiTest.java index 5577b7be8a..499d8f32d9 100644 --- a/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientApiTest.java +++ b/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientApiTest.java @@ -399,12 +399,12 @@ public void async_retrofit_call_should_throw_RemoteException_for_server_serializ retrofit2.Call call = service.getRelative(); call.enqueue(new retrofit2.Callback() { @Override - public void onResponse(Call call, Response response) { + public void onResponse(Call _call, Response _response) { failBecauseExceptionWasNotThrown(RemoteException.class); } @Override - public void onFailure(Call call, Throwable throwable) { + public void onFailure(Call _call, Throwable throwable) { assertThat(throwable).isInstanceOf(RemoteException.class); assertThat(((RemoteException) throwable).getError()).isEqualTo(ERROR); assertionsPassed.countDown(); // if you delete this countdown latch then this test will vacuously pass. diff --git a/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientConfigRefreshTest.java b/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientConfigRefreshTest.java index ebe366e06a..d58432193e 100644 --- a/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientConfigRefreshTest.java +++ b/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientConfigRefreshTest.java @@ -49,13 +49,13 @@ public void testConfigRefresh() throws Exception { server1.enqueue(new MockResponse().setBody("\"server1\"")); assertThat(proxy.get().execute().body()).isEqualTo("server1"); assertThat(server1.getRequestCount()).isEqualTo(1); - assertThat(server2.getRequestCount()).isEqualTo(0); + assertThat(server2.getRequestCount()).isZero(); // Call 2 server1.enqueue(new MockResponse().setBody("\"server1\"")); assertThat(proxy.get().execute().body()).isEqualTo("server1"); assertThat(server1.getRequestCount()).isEqualTo(2); - assertThat(server2.getRequestCount()).isEqualTo(0); + assertThat(server2.getRequestCount()).isZero(); // Switch config refreshableConfig.set(config2); diff --git a/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientFailoverTest.java b/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientFailoverTest.java index ffd2a7f6a7..5ad8670831 100644 --- a/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientFailoverTest.java +++ b/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientFailoverTest.java @@ -130,12 +130,12 @@ public void testQosError_performsFailover_forAsynchronousOperation( CompletableFuture future = new CompletableFuture<>(); proxy.get().enqueue(new Callback() { @Override - public void onResponse(Call call, Response response) { + public void onResponse(Call _call, Response response) { future.complete(response.body()); } @Override - public void onFailure(Call call, Throwable throwable) { + public void onFailure(Call _call, Throwable throwable) { future.completeExceptionally(throwable); } }); @@ -215,12 +215,12 @@ public void testQosError_performsRetryWithOneNode_forAsynchronousOperation() thr CompletableFuture future = new CompletableFuture<>(); anotherProxy.get().enqueue(new Callback() { @Override - public void onResponse(Call call, Response response) { + public void onResponse(Call _call, Response response) { future.complete(response.body()); } @Override - public void onFailure(Call call, Throwable throwable) { + public void onFailure(Call _call, Throwable throwable) { future.completeExceptionally(throwable); } }); @@ -247,12 +247,12 @@ public void testQosError_performsRetryWithOneNodeAndCache_forAsynchronousOperati CompletableFuture future = new CompletableFuture<>(); anotherProxy.get().enqueue(new Callback() { @Override - public void onResponse(Call call, Response response) { + public void onResponse(Call _call, Response response) { future.complete(response.body()); } @Override - public void onFailure(Call call, Throwable throwable) { + public void onFailure(Call _call, Throwable throwable) { future.completeExceptionally(throwable); } }); diff --git a/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientProxyTest.java b/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientProxyTest.java index 950da06bee..a7ad355613 100644 --- a/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientProxyTest.java +++ b/conjure-java-retrofit2-client/src/test/java/com/palantir/conjure/java/client/retrofit2/Retrofit2ClientProxyTest.java @@ -89,13 +89,13 @@ public void testAuthenticatedProxy() throws Exception { private static ProxySelector createProxySelector(String host, int port) { return new ProxySelector() { @Override - public List select(URI uri) { + public List select(URI _uri) { InetSocketAddress addr = new InetSocketAddress(host, port); return ImmutableList.of(new Proxy(Proxy.Type.HTTP, addr)); } @Override - public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {} + public void connectFailed(URI _uri, SocketAddress _sa, IOException _ioe) {} }; } } diff --git a/conjure-java-server-verifier/src/test/java/com/palantir/verification/server/AutoDeserializeTest.java b/conjure-java-server-verifier/src/test/java/com/palantir/verification/server/AutoDeserializeTest.java index 716cc434b0..35ff484bdd 100644 --- a/conjure-java-server-verifier/src/test/java/com/palantir/verification/server/AutoDeserializeTest.java +++ b/conjure-java-server-verifier/src/test/java/com/palantir/verification/server/AutoDeserializeTest.java @@ -36,12 +36,13 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import org.slf4j.Logger; import org.slf4j.LoggerFactory; @RunWith(Parameterized.class) public class AutoDeserializeTest { - private static final Logger log = LoggerFactory.getLogger(AutoDeserializeTest.class); + static { + LoggerFactory.getLogger(AutoDeserializeTest.class); + } @ClassRule public static final DropwizardAppRule serverUnderTestRule = new DropwizardAppRule<>( diff --git a/conjure-java-server-verifier/src/test/java/com/palantir/verification/server/undertest/ServerUnderTestApplication.java b/conjure-java-server-verifier/src/test/java/com/palantir/verification/server/undertest/ServerUnderTestApplication.java index 4007a8895f..1cd2299cab 100644 --- a/conjure-java-server-verifier/src/test/java/com/palantir/verification/server/undertest/ServerUnderTestApplication.java +++ b/conjure-java-server-verifier/src/test/java/com/palantir/verification/server/undertest/ServerUnderTestApplication.java @@ -44,7 +44,7 @@ public void initialize(Bootstrap bootstrap) { } @Override - public void run(Configuration configuration, Environment environment) { + public void run(Configuration _configuration, Environment environment) { environment.jersey() .register( Reflection.newProxy(AutoDeserializeService.class, new EchoResourceInvocationHandler())); @@ -59,7 +59,7 @@ public void run(Configuration configuration, Environment environment) { */ static class EchoResourceInvocationHandler extends AbstractInvocationHandler { @Override - protected Object handleInvocation(Object proxy, Method method, Object[] args) { + protected Object handleInvocation(Object _proxy, Method method, Object[] args) { Preconditions.checkArgument(args.length == 1, "Expected single argument. Method: %s", method); return args[0]; } diff --git a/keystores/src/test/java/com/palantir/conjure/java/config/ssl/KeyStoresTests.java b/keystores/src/test/java/com/palantir/conjure/java/config/ssl/KeyStoresTests.java index 2c1efd7f0f..7852453484 100644 --- a/keystores/src/test/java/com/palantir/conjure/java/config/ssl/KeyStoresTests.java +++ b/keystores/src/test/java/com/palantir/conjure/java/config/ssl/KeyStoresTests.java @@ -66,7 +66,7 @@ public void testCreateTrustStoreFromEmptyDirectory() throws GeneralSecurityExcep File certFolder = tempFolder.newFolder(); KeyStore trustStore = KeyStores.createTrustStoreFromCertificates(certFolder.toPath()); - assertThat(trustStore.size()).isEqualTo(0); + assertThat(trustStore.size()).isZero(); } @Test @@ -75,7 +75,7 @@ public void testCreateTrustStoreFromDirectoryIgnoresHiddenFiles() throws IOExcep Files.copy(TestConstants.CA_DER_CERT_PATH.toFile(), certFolder.toPath().resolve(".hidden_file").toFile()); KeyStore trustStore = KeyStores.createTrustStoreFromCertificates(certFolder.toPath()); - assertThat(trustStore.size()).isEqualTo(0); + assertThat(trustStore.size()).isZero(); } @Test @@ -167,7 +167,7 @@ public void testCreateKeyStoreFromEmptyDirectory() throws GeneralSecurityExcepti File keyFolder = tempFolder.newFolder(); KeyStore trustStore = KeyStores.createKeyStoreFromCombinedPems(keyFolder.toPath(), "changeit"); - assertThat(trustStore.size()).isEqualTo(0); + assertThat(trustStore.size()).isZero(); } @Test diff --git a/keystores/src/test/java/com/palantir/conjure/java/config/ssl/pkcs1/Pkcs1ReadersTests.java b/keystores/src/test/java/com/palantir/conjure/java/config/ssl/pkcs1/Pkcs1ReadersTests.java index 9a9d02810e..3562f1dff7 100644 --- a/keystores/src/test/java/com/palantir/conjure/java/config/ssl/pkcs1/Pkcs1ReadersTests.java +++ b/keystores/src/test/java/com/palantir/conjure/java/config/ssl/pkcs1/Pkcs1ReadersTests.java @@ -31,7 +31,7 @@ public final class Pkcs1ReadersTests { public void testReadPrivateKeyFailsIfNoProvidersPresent() throws IOException { Assume.assumeFalse(ServiceLoader.load(Pkcs1Reader.class).iterator().hasNext()); - assertThatThrownBy(() -> Pkcs1Readers.getInstance()) + assertThatThrownBy(Pkcs1Readers::getInstance) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("No Pkcs1Reader services were present"); } diff --git a/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/HostMetricsTest.java b/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/HostMetricsTest.java index 83570c3530..a903b4e973 100644 --- a/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/HostMetricsTest.java +++ b/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/HostMetricsTest.java @@ -90,7 +90,7 @@ public void testUpdateMetricUpdatesMeter_other() { private void testUpdateMetricUpdatesMeter(int statusCode, Timer timer) { assertThat(timer.getCount()).isZero(); - assertThat(timer.getSnapshot().getMin()).isEqualTo(0); + assertThat(timer.getSnapshot().getMin()).isZero(); hostMetrics.record(statusCode, 1); diff --git a/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/InstrumentedInterceptorTest.java b/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/InstrumentedInterceptorTest.java index 3a9239012c..6c62f4628b 100644 --- a/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/InstrumentedInterceptorTest.java +++ b/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/InstrumentedInterceptorTest.java @@ -85,7 +85,7 @@ public void testResponseMetricRegistered() throws IOException { .build(); Timer timer = registry.timer(name); - assertThat(timer.getCount()).isEqualTo(0); + assertThat(timer.getCount()).isZero(); successfulRequest(REQUEST_A); interceptor.intercept(chain); diff --git a/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/LeakDetectorTest.java b/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/LeakDetectorTest.java index fd84d176e5..e7775afab1 100644 --- a/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/LeakDetectorTest.java +++ b/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/LeakDetectorTest.java @@ -45,7 +45,7 @@ public void canUnregister() { String track = UUID.randomUUID().toString(); leakDetector.register(track, Optional.empty()); leakDetector.unregister(track); - track = null; + System.gc(); leakDetector.register("trigger", Optional.empty()); assertThat(leaks).isEmpty(); diff --git a/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/OkHttpClientsTest.java b/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/OkHttpClientsTest.java index 3a2545e16a..4dd471f895 100644 --- a/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/OkHttpClientsTest.java +++ b/okhttp-clients/src/test/java/com/palantir/conjure/java/okhttp/OkHttpClientsTest.java @@ -123,12 +123,12 @@ public void cancelCall() { } @Override - public void onFailure(Call unused, IOException exception) { + public void onFailure(Call _value, IOException exception) { setException(exception); } @Override - public void onResponse(Call unused, Response response) { + public void onResponse(Call _value, Response response) { set(response); } @@ -253,10 +253,10 @@ public void handlesSuccessfulResponseCodesWithSuccessHandler() throws Exception CountDownLatch wasSuccessful = new CountDownLatch(1); call.enqueue(new Callback() { @Override - public void onFailure(Call call, IOException exception) {} + public void onFailure(Call _call, IOException _exception) {} @Override - public void onResponse(Call call, Response response) throws IOException { + public void onResponse(Call _call, Response response) throws IOException { if (response.code() == code) { wasSuccessful.countDown(); } @@ -275,12 +275,12 @@ public void successfulCallDoesNotInvokeFailureHandler() throws Exception { Semaphore successHandlerExecuted = new Semaphore(0); call.enqueue(new Callback() { @Override - public void onFailure(Call call, IOException ioException) { + public void onFailure(Call _call, IOException _ioException) { failureHandlerExecuted.release(); // should never happen } @Override - public void onResponse(Call call, Response response) throws IOException { + public void onResponse(Call _call, Response _response) throws IOException { successHandlerExecuted.release(); } }); @@ -299,12 +299,12 @@ public void unsuccessfulCallDoesNotInvokeSuccessHandler() throws Exception { Semaphore successHandlerExecuted = new Semaphore(0); call.enqueue(new Callback() { @Override - public void onFailure(Call call, IOException ioException) { + public void onFailure(Call _call, IOException _ioException) { failureHandlerExecuted.release(); } @Override - public void onResponse(Call call, Response response) throws IOException { + public void onResponse(Call _call, Response _response) throws IOException { successHandlerExecuted.release(); // should never happen } }); @@ -498,12 +498,12 @@ public void handlesQosExceptions_asyncCall() throws Exception { CompletableFuture future = new CompletableFuture<>(); call.enqueue(new Callback() { @Override - public void onFailure(Call call, IOException ioException) { + public void onFailure(Call _call, IOException ioException) { future.completeExceptionally(ioException); } @Override - public void onResponse(Call call, Response response) throws IOException { + public void onResponse(Call _call, Response response) throws IOException { future.complete(response.body().string()); } }); @@ -639,7 +639,7 @@ public void handlesIoExceptions_obeysMaxNumRetries() throws Exception { .hasLogMessage("Failed to complete the request due to an IOException") .hasExactlyArgs(UnsafeArg.of("requestUrl", url2 + "/foo?bar")); - assertThat(server3.getRequestCount()).isEqualTo(0); + assertThat(server3.getRequestCount()).isZero(); } @Test @@ -902,12 +902,12 @@ public void non_ioexceptions_dont_break_the_world() throws IOException { HostEventsSink throwingSink = new HostEventsSink() { @Override - public void record(String serviceName, String hostname, int port, int statusCode, long micros) { + public void record(String _serviceName, String _hostname, int _port, int _statusCode, long _micros) { throw new IllegalStateException("I am not an IOException"); } @Override - public void recordIoException(String serviceName, String hostname, int port) { + public void recordIoException(String _serviceName, String _hostname, int _port) { //empty; } };