Fix lint warnings

This commit is contained in:
Eric Anderson 2020-08-07 09:17:19 -07:00 committed by Eric Anderson
parent 47301752b1
commit 020fb36753
5 changed files with 16 additions and 19 deletions

View File

@ -284,7 +284,6 @@ public class ServerInterceptorsTest {
@Test
public void argumentsPassed() {
@SuppressWarnings("unchecked")
final ServerCall<String, Integer> call2 = new NoopServerCall<>();
@SuppressWarnings("unchecked")
final ServerCall.Listener<String> listener2 = mock(ServerCall.Listener.class);

View File

@ -199,7 +199,6 @@ public class CensusModulesTest {
private CensusTracingModule censusTracing;
@Before
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
when(spyClientSpanBuilder.startSpan()).thenReturn(spyClientSpan);
when(tracer.spanBuilderWithExplicitParent(anyString(), ArgumentMatchers.<Span>any()))

View File

@ -969,7 +969,6 @@ public class Context {
/**
* Get the value from the {@link #current()} context for this key.
*/
@SuppressWarnings("unchecked")
public T get() {
return get(Context.current());
}

View File

@ -140,7 +140,6 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.ArgumentCaptor;
@ -210,7 +209,6 @@ public class ManagedChannelImplTest {
private final InternalChannelz channelz = new InternalChannelz();
@Rule public final ExpectedException thrown = ExpectedException.none();
@Rule public final MockitoRule mocks = MockitoJUnit.rule();
private ManagedChannelImpl channel;

View File

@ -927,11 +927,11 @@ public final class BinlogHelperTest {
}
@Test
@SuppressWarnings({"rawtypes", "unchecked"})
public void serverDeadlineLogged() {
final AtomicReference<ServerCall> interceptedCall =
final AtomicReference<ServerCall<byte[], byte[]>> interceptedCall =
new AtomicReference<>();
final ServerCall.Listener mockListener = mock(ServerCall.Listener.class);
@SuppressWarnings("unchecked")
final ServerCall.Listener<byte[]> mockListener = mock(ServerCall.Listener.class);
final MethodDescriptor<byte[], byte[]> method =
MethodDescriptor.<byte[], byte[]>newBuilder()
@ -986,7 +986,6 @@ public final class BinlogHelperTest {
}
@Test
@SuppressWarnings({"unchecked"})
public void clientDeadlineLogged_deadlineSetViaCallOption() {
MethodDescriptor<byte[], byte[]> method =
MethodDescriptor.<byte[], byte[]>newBuilder()
@ -995,6 +994,7 @@ public final class BinlogHelperTest {
.setRequestMarshaller(BYTEARRAY_MARSHALLER)
.setResponseMarshaller(BYTEARRAY_MARSHALLER)
.build();
@SuppressWarnings("unchecked")
ClientCall.Listener<byte[]> mockListener = mock(ClientCall.Listener.class);
ClientCall<byte[], byte[]> call =
@ -1035,7 +1035,6 @@ public final class BinlogHelperTest {
}
@Test
@SuppressWarnings({"unchecked"})
public void clientDeadlineLogged_deadlineSetViaContext() throws Exception {
// important: deadline is read from the ctx where call was created
final SettableFuture<ClientCall<byte[], byte[]>> callFuture = SettableFuture.create();
@ -1073,6 +1072,7 @@ public final class BinlogHelperTest {
}));
}
});
@SuppressWarnings("unchecked")
ClientCall.Listener<byte[]> mockListener = mock(ClientCall.Listener.class);
callFuture.get().start(mockListener, new Metadata());
ArgumentCaptor<Duration> callOptTimeoutCaptor = ArgumentCaptor.forClass(Duration.class);
@ -1093,9 +1093,8 @@ public final class BinlogHelperTest {
}
@Test
@SuppressWarnings({"rawtypes", "unchecked"})
public void clientInterceptor() throws Exception {
final AtomicReference<ClientCall.Listener> interceptedListener =
final AtomicReference<ClientCall.Listener<byte[]>> interceptedListener =
new AtomicReference<>();
// capture these manually because ClientCall can not be mocked
final AtomicReference<Metadata> actualClientInitial = new AtomicReference<>();
@ -1109,8 +1108,9 @@ public final class BinlogHelperTest {
MethodDescriptor<RequestT, ResponseT> methodDescriptor, CallOptions callOptions) {
return new NoopClientCall<RequestT, ResponseT>() {
@Override
@SuppressWarnings("unchecked")
public void start(Listener<ResponseT> responseListener, Metadata headers) {
interceptedListener.set(responseListener);
interceptedListener.set((Listener<byte[]>) responseListener);
actualClientInitial.set(headers);
}
@ -1142,6 +1142,7 @@ public final class BinlogHelperTest {
}
};
@SuppressWarnings("unchecked")
ClientCall.Listener<byte[]> mockListener = mock(ClientCall.Listener.class);
MethodDescriptor<byte[], byte[]> method =
@ -1260,9 +1261,8 @@ public final class BinlogHelperTest {
}
@Test
@SuppressWarnings({"rawtypes", "unchecked"})
public void clientInterceptor_trailersOnlyResponseLogsPeerAddress() throws Exception {
final AtomicReference<ClientCall.Listener> interceptedListener =
final AtomicReference<ClientCall.Listener<byte[]>> interceptedListener =
new AtomicReference<>();
// capture these manually because ClientCall can not be mocked
final AtomicReference<Metadata> actualClientInitial = new AtomicReference<>();
@ -1274,8 +1274,9 @@ public final class BinlogHelperTest {
MethodDescriptor<RequestT, ResponseT> methodDescriptor, CallOptions callOptions) {
return new NoopClientCall<RequestT, ResponseT>() {
@Override
@SuppressWarnings("unchecked")
public void start(Listener<ResponseT> responseListener, Metadata headers) {
interceptedListener.set(responseListener);
interceptedListener.set((Listener<byte[]>) responseListener);
actualClientInitial.set(headers);
}
@ -1297,6 +1298,7 @@ public final class BinlogHelperTest {
}
};
@SuppressWarnings("unchecked")
ClientCall.Listener<byte[]> mockListener = mock(ClientCall.Listener.class);
MethodDescriptor<byte[], byte[]> method =
@ -1345,12 +1347,12 @@ public final class BinlogHelperTest {
}
@Test
@SuppressWarnings({"rawtypes", "unchecked"})
public void serverInterceptor() throws Exception {
final AtomicReference<ServerCall> interceptedCall =
final AtomicReference<ServerCall<byte[], byte[]>> interceptedCall =
new AtomicReference<>();
ServerCall.Listener<byte[]> capturedListener;
final ServerCall.Listener mockListener = mock(ServerCall.Listener.class);
@SuppressWarnings("unchecked")
final ServerCall.Listener<byte[]> mockListener = mock(ServerCall.Listener.class);
// capture these manually because ServerCall can not be mocked
final AtomicReference<Metadata> actualServerInitial = new AtomicReference<>();
final AtomicReference<byte[]> actualResponse = new AtomicReference<>();