GrpcDocServicePlugin implements DocServicePlugin { @VisibleForTesting StructInfo newStructInfo(Descriptor descriptor) { return new StructInfo( descriptor.getFullName(), descriptor.getFields().stream() .map(GrpcDocServicePlugin::newFieldInfo) .collect(toImmutableList())); }  @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 newStructInfo() throws Exception { final StructInfo structInfo = generator.newStructInfo(TestMessage.getDescriptor()); assertThat(structInfo.name()).isEqualTo("armeria.grpc.testing.TestMessage"); assertThat(structInfo.fields()).hasSize(18); assertThat(structInfo.fields().get(0).name()).isEqualTo("bool"); assertThat(structInfo.fields().get(0).typeSignature()).isEqualTo(GrpcDocServicePlugin.BOOL); assertThat(structInfo.fields().get(1).name()).isEqualTo("int32"); assertThat(structInfo.fields().get(1).typeSignature()).isEqualTo(GrpcDocServicePlugin.INT32); assertThat(structInfo.fields().get(2).name()).isEqualTo("int64"); assertThat(structInfo.fields().get(2).typeSignature()).isEqualTo(GrpcDocServicePlugin.INT64); assertThat(structInfo.fields().get(3).name()).isEqualTo("uint32"); assertThat(structInfo.fields().get(3).typeSignature()).isEqualTo(GrpcDocServicePlugin.UINT32); assertThat(structInfo.fields().get(4).name()).isEqualTo("uint64"); assertThat(structInfo.fields().get(4).typeSignature()).isEqualTo(GrpcDocServicePlugin.UINT64); assertThat(structInfo.fields().get(5).name()).isEqualTo("sint32"); assertThat(structInfo.fields().get(5).typeSignature()).isEqualTo(GrpcDocServicePlugin.SINT32); assertThat(structInfo.fields().get(6).name()).isEqualTo("sint64"); assertThat(structInfo.fields().get(6).typeSignature()).isEqualTo(GrpcDocServicePlugin.SINT64); assertThat(structInfo.fields().get(7).name()).isEqualTo("fixed32"); assertThat(structInfo.fields().get(7).typeSignature()).isEqualTo(GrpcDocServicePlugin.FIXED32); assertThat(structInfo.fields().get(8).name()).isEqualTo("fixed64"); assertThat(structInfo.fields().get(8).typeSignature()).isEqualTo(GrpcDocServicePlugin.FIXED64); assertThat(structInfo.fields().get(9).name()).isEqualTo("float"); assertThat(structInfo.fields().get(9).typeSignature()).isEqualTo(GrpcDocServicePlugin.FLOAT); assertThat(structInfo.fields().get(10).name()).isEqualTo("double"); assertThat(structInfo.fields().get(10).typeSignature()).isEqualTo(GrpcDocServicePlugin.DOUBLE); assertThat(structInfo.fields().get(11).name()).isEqualTo("string"); assertThat(structInfo.fields().get(11).typeSignature()).isEqualTo(GrpcDocServicePlugin.STRING); assertThat(structInfo.fields().get(12).name()).isEqualTo("bytes"); assertThat(structInfo.fields().get(12).typeSignature()).isEqualTo(GrpcDocServicePlugin.BYTES); assertThat(structInfo.fields().get(13).name()).isEqualTo("test_enum"); assertThat(structInfo.fields().get(13).typeSignature().signature()) .isEqualTo("armeria.grpc.testing.TestEnum"); assertThat(structInfo.fields().get(14).name()).isEqualTo("nested"); assertThat(structInfo.fields().get(14).typeSignature().signature()) .isEqualTo("armeria.grpc.testing.TestMessage.Nested"); assertThat(structInfo.fields().get(15).name()).isEqualTo("strings"); assertThat(structInfo.fields().get(15).typeSignature().typeParameters()) .containsExactly(GrpcDocServicePlugin.STRING); assertThat(structInfo.fields().get(16).name()).isEqualTo("map"); assertThat(structInfo.fields().get(16).typeSignature().typeParameters()) .containsExactly(GrpcDocServicePlugin.STRING, GrpcDocServicePlugin.INT32); assertThat(structInfo.fields().get(17).name()).isEqualTo("self"); assertThat(structInfo.fields().get(17).typeSignature().signature()) .isEqualTo("armeria.grpc.testing.TestMessage"); }