GrpcDocServicePlugin implements DocServicePlugin { @Nullable ServiceInfo newServiceInfo(ServiceEntry entry, DocServiceFilter filter) { final List<MethodInfo> methodInfos = entry.methods().stream() .filter(m -> filter.test(name(), entry.name(), m.getName())) .map(m -> newMethodInfo(m, entry)) .collect(toImmutableList()); if (methodInfos.isEmpty()) { return null; } return new ServiceInfo(entry.name(), methodInfos); }  @Override String name(); @Override Set<Class<? extends Service<?, ?>>> supportedServiceTypes(); @Override ServiceSpecification generateSpecification(Set<ServiceConfig> serviceConfigs,
                                                      DocServiceFilter filter); @Override Map<String, String> loadDocStrings(Set<ServiceConfig> serviceConfigs); @Override Set<Class<?>> supportedExampleRequestTypes(); @Override String serializeExampleRequest(String serviceName, String methodName,
                                          Object exampleRequest);  }
@Test void newServiceInfo() throws Exception { final ServiceInfo service = generator.newServiceInfo( new ServiceEntry( TEST_SERVICE_DESCRIPTOR, ImmutableList.of( EndpointInfo.builder("*", "/foo") .fragment("a").availableFormats(GrpcSerializationFormats.PROTO) .build(), EndpointInfo.builder("*", "/debug/foo") .fragment("b").availableFormats(GrpcSerializationFormats.JSON) .build())), (pluginName, serviceName, methodName) -> true); final Map<String, MethodInfo> functions = service.methods() .stream() .collect(toImmutableMap(MethodInfo::name, Function.identity())); assertThat(functions).hasSize(8); final MethodInfo emptyCall = functions.get("EmptyCall"); assertThat(emptyCall.name()).isEqualTo("EmptyCall"); assertThat(emptyCall.parameters()) .containsExactly(FieldInfo.builder("request", TypeSignature.ofNamed("armeria.grpc.testing.Empty", Empty.getDescriptor())) .requirement(FieldRequirement.REQUIRED) .build()); assertThat(emptyCall.returnTypeSignature()) .isEqualTo(TypeSignature.ofNamed("armeria.grpc.testing.Empty", Empty.getDescriptor())); assertThat(functions.get("UnaryCall").name()).isEqualTo("UnaryCall"); assertThat(functions.get("UnaryCall2").name()).isEqualTo("UnaryCall2"); assertThat(functions.get("StreamingOutputCall").name()).isEqualTo("StreamingOutputCall"); assertThat(functions.get("StreamingInputCall").name()).isEqualTo("StreamingInputCall"); assertThat(functions.get("FullDuplexCall").name()).isEqualTo("FullDuplexCall"); assertThat(functions.get("HalfDuplexCall").name()).isEqualTo("HalfDuplexCall"); assertThat(functions.get("UnimplementedCall").name()).isEqualTo("UnimplementedCall"); }