mirror of https://github.com/grpc/grpc-java.git
api,core,stub: fix lint errors (#6305)
This commit is contained in:
parent
ecbc5e4f47
commit
ae11b9facc
|
|
@ -490,7 +490,6 @@ public final class MethodDescriptor<ReqT, RespT> {
|
||||||
* @param responseMarshaller the marshaller to use.
|
* @param responseMarshaller the marshaller to use.
|
||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public Builder<ReqT, RespT> setResponseMarshaller(Marshaller<RespT> responseMarshaller) {
|
public Builder<ReqT, RespT> setResponseMarshaller(Marshaller<RespT> responseMarshaller) {
|
||||||
this.responseMarshaller = responseMarshaller;
|
this.responseMarshaller = responseMarshaller;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
||||||
|
|
@ -451,7 +451,6 @@ final class DnsNameResolver extends NameResolver {
|
||||||
*
|
*
|
||||||
* @throws IOException if one of the txt records contains improperly formatted JSON.
|
* @throws IOException if one of the txt records contains improperly formatted JSON.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static List<Map<String, ?>> parseTxtResults(List<String> txtRecords) throws IOException {
|
static List<Map<String, ?>> parseTxtResults(List<String> txtRecords) throws IOException {
|
||||||
List<Map<String, ?>> possibleServiceConfigChoices = new ArrayList<>();
|
List<Map<String, ?>> possibleServiceConfigChoices = new ArrayList<>();
|
||||||
|
|
|
||||||
|
|
@ -355,7 +355,6 @@ public final class ServiceConfigUtil {
|
||||||
/**
|
/**
|
||||||
* Extracts load balancing configs from a service config.
|
* Extracts load balancing configs from a service config.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public static List<Map<String, ?>> getLoadBalancingConfigsFromServiceConfig(
|
public static List<Map<String, ?>> getLoadBalancingConfigsFromServiceConfig(
|
||||||
Map<String, ?> serviceConfig) {
|
Map<String, ?> serviceConfig) {
|
||||||
|
|
@ -400,7 +399,6 @@ public final class ServiceConfigUtil {
|
||||||
* (map) with exactly one entry, where the key is the policy name and the value is a config object
|
* (map) with exactly one entry, where the key is the policy name and the value is a config object
|
||||||
* for that policy.
|
* for that policy.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static LbConfig unwrapLoadBalancingConfig(Map<String, ?> lbConfig) {
|
public static LbConfig unwrapLoadBalancingConfig(Map<String, ?> lbConfig) {
|
||||||
if (lbConfig.size() != 1) {
|
if (lbConfig.size() != 1) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
|
|
@ -414,7 +412,6 @@ public final class ServiceConfigUtil {
|
||||||
/**
|
/**
|
||||||
* Given a JSON list of LoadBalancingConfigs, and convert it into a list of LbConfig.
|
* Given a JSON list of LoadBalancingConfigs, and convert it into a list of LbConfig.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static List<LbConfig> unwrapLoadBalancingConfigList(List<Map<String, ?>> list) {
|
public static List<LbConfig> unwrapLoadBalancingConfigList(List<Map<String, ?>> list) {
|
||||||
ArrayList<LbConfig> result = new ArrayList<>();
|
ArrayList<LbConfig> result = new ArrayList<>();
|
||||||
for (Map<String, ?> rawChildPolicy : list) {
|
for (Map<String, ?> rawChildPolicy : list) {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
import io.grpc.CallOptions;
|
import io.grpc.CallOptions;
|
||||||
|
|
@ -48,15 +49,24 @@ abstract class BaseAbstractStubTest<T extends AbstractStub<T>> {
|
||||||
|
|
||||||
abstract T create(@Nullable Channel channel, @Nullable CallOptions callOptions);
|
abstract T create(@Nullable Channel channel, @Nullable CallOptions callOptions);
|
||||||
|
|
||||||
@Test(expected = NullPointerException.class)
|
@Test
|
||||||
public void callOptionsMustNotBeNull() {
|
public void callOptionsMustNotBeNull() {
|
||||||
create(channel, null);
|
try {
|
||||||
throw new NullPointerException();
|
create(channel, null);
|
||||||
|
fail("NullPointerException expected");
|
||||||
|
} catch (NullPointerException npe) {
|
||||||
|
// expected
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NullPointerException.class)
|
@Test
|
||||||
public void channelMustNotBeNull2() {
|
public void channelMustNotBeNull2() {
|
||||||
create(null, CallOptions.DEFAULT);
|
try {
|
||||||
|
create(null, CallOptions.DEFAULT);
|
||||||
|
fail("NullPointerException expected");
|
||||||
|
} catch (NullPointerException npe) {
|
||||||
|
// expected
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -134,9 +134,9 @@ public class ClientCallsTest {
|
||||||
};
|
};
|
||||||
|
|
||||||
ClientCalls.asyncUnaryCall(call, req, responseObserver);
|
ClientCalls.asyncUnaryCall(call, req, responseObserver);
|
||||||
assertThat(actualResponse.size()).isEqualTo(1);
|
assertThat(actualResponse).hasSize(1);
|
||||||
assertEquals(resp, actualResponse.get(0));
|
assertEquals(resp, actualResponse.get(0));
|
||||||
assertThat(completed.size()).isEqualTo(1);
|
assertThat(completed).hasSize(1);
|
||||||
assertThat(completed.get(0)).isTrue();
|
assertThat(completed.get(0)).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,7 +173,7 @@ public class ClientCallsTest {
|
||||||
};
|
};
|
||||||
|
|
||||||
ClientCalls.asyncUnaryCall(call, req, responseObserver);
|
ClientCalls.asyncUnaryCall(call, req, responseObserver);
|
||||||
assertThat(expected.size()).isEqualTo(1);
|
assertThat(expected).hasSize(1);
|
||||||
assertThat(expected.get(0)).hasMessageThat()
|
assertThat(expected.get(0)).hasMessageThat()
|
||||||
.isEqualTo("INTERNAL: Response message is null for unary call");
|
.isEqualTo("INTERNAL: Response message is null for unary call");
|
||||||
}
|
}
|
||||||
|
|
@ -212,7 +212,7 @@ public class ClientCallsTest {
|
||||||
};
|
};
|
||||||
|
|
||||||
ClientCalls.asyncUnaryCall(call, req, responseObserver);
|
ClientCalls.asyncUnaryCall(call, req, responseObserver);
|
||||||
assertThat(expected.size()).isEqualTo(1);
|
assertThat(expected).hasSize(1);
|
||||||
assertThat(expected.get(0)).hasMessageThat().isEqualTo("INTERNAL: Unique status");
|
assertThat(expected.get(0)).hasMessageThat().isEqualTo("INTERNAL: Unique status");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue