Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up compile warnings #1728

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -121,7 +121,9 @@ public void onSuccess(PutMetricDataRequest request, PutMetricDataResult result)
}
});
try {
latch.await(config.readTimeout().toMillis(), TimeUnit.MILLISECONDS);
@SuppressWarnings("deprecation")
long readTimeoutMillis = config.readTimeout().toMillis();
latch.await(readTimeoutMillis, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
logger.warn("metrics push to cloudwatch took longer than expected");
throw e;
Expand Down
Expand Up @@ -145,6 +145,7 @@ void writeMeterWithGaugeShouldDropNanValue() {
assertThat(meterRegistry.writeMeter(gauge)).isEmpty();
}

@SuppressWarnings("unchecked")
@Test
void writeMeterWithGaugeWhenChangingFiniteToNaNShouldWork() {
AtomicBoolean first = new AtomicBoolean(true);
Expand Down
Expand Up @@ -17,7 +17,6 @@

import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.MockClock;
import io.micrometer.core.instrument.util.HierarchicalNameMapper;
import io.micrometer.core.lang.Nullable;
import io.micrometer.core.tck.MeterRegistryCompatibilityKit;

Expand All @@ -26,7 +25,7 @@
class GangliaMeterRegistryCompatibilityTest extends MeterRegistryCompatibilityKit {
@Override
public MeterRegistry registry() {
return new GangliaMeterRegistry(new GangliaConfig() {
return GangliaMeterRegistry.builder(new GangliaConfig() {
@Override
public boolean enabled() {
return false;
Expand All @@ -37,7 +36,7 @@ public boolean enabled() {
public String get(String key) {
return null;
}
}, new MockClock(), HierarchicalNameMapper.DEFAULT);
}).clock(new MockClock()).build();
}

@Override
Expand Down
Expand Up @@ -36,6 +36,7 @@ void compressShouldAddContentEncodingHeader() throws IOException, NoSuchFieldExc
HttpSender.Request.Builder builder = HttpSender.Request.build("https://micrometer.io/", mock(HttpSender.class)).compress();
Field requestHeadersField = HttpSender.Request.Builder.class.getDeclaredField("requestHeaders");
requestHeadersField.setAccessible(true);
@SuppressWarnings("unchecked")
Map<String, String> requestHeaders = (Map<String, String>) requestHeadersField.get(builder);
assertThat(requestHeaders).containsEntry("Content-Encoding", "gzip");
}
Expand Down
Expand Up @@ -53,11 +53,13 @@ public boolean enabled() {
return get(T::isEnabled, StepRegistryConfig.super::enabled);
}

@SuppressWarnings("deprecation")
@Override
public Duration connectTimeout() {
return get(T::getConnectTimeout, StepRegistryConfig.super::connectTimeout);
}

@SuppressWarnings("deprecation")
@Override
public Duration readTimeout() {
return get(T::getReadTimeout, StepRegistryConfig.super::readTimeout);
Expand Down
Expand Up @@ -27,6 +27,7 @@
*/
public abstract class StepRegistryPropertiesTest {

@SuppressWarnings("deprecation")
protected void assertStepRegistryDefaultValues(StepRegistryProperties properties,
StepRegistryConfig config) {
assertThat(properties.getStep()).isEqualTo(config.step());
Expand Down
Expand Up @@ -79,15 +79,15 @@ public void outcomeTagIsServerErrorWhenResponseIs5xx() {
@Test
public void outcomeTagIsUnknownWhenResponseThrowsIOException() throws Exception {
ClientHttpResponse response = mock(ClientHttpResponse.class);
given(response.getRawStatusCode()).willThrow(IOException.class);
given(response.getRawStatusCode()).willThrow(new IOException());
Tag tag = RestTemplateExchangeTags.outcome(response);
assertThat(tag.getValue()).isEqualTo("UNKNOWN");
}

@Test
public void outcomeTagIsUnknownForCustomResponseStatus() throws Exception {
ClientHttpResponse response = mock(ClientHttpResponse.class);
given(response.getRawStatusCode()).willThrow(IllegalArgumentException.class);
given(response.getRawStatusCode()).willThrow(new IllegalArgumentException());
Tag tag = RestTemplateExchangeTags.outcome(response);
assertThat(tag.getValue()).isEqualTo("UNKNOWN");
}
Expand Down