ServiceBuilder extends AbstractServiceBuilder<ServiceConfig, ServiceBuilder<U>> { public ServiceConfig<U> build() { ServiceConfig<U> serviceConfig = new ServiceConfig<>(); super.build(serviceConfig); serviceConfig.setInterface(interfaceName); serviceConfig.setInterface(interfaceClass); serviceConfig.setRef(ref); serviceConfig.setPath(path); serviceConfig.setMethods(methods); serviceConfig.setProvider(provider); serviceConfig.setProviderIds(providerIds); serviceConfig.setGeneric(generic); return serviceConfig; }  static ServiceBuilder newBuilder(); ServiceBuilder id(String id); ServiceBuilder<U> interfaceName(String interfaceName); ServiceBuilder<U> interfaceClass(Class<?> interfaceClass); ServiceBuilder<U> ref(U ref); ServiceBuilder<U> path(String path); ServiceBuilder<U> addMethod(MethodConfig method); ServiceBuilder<U> addMethods(List<? extends MethodConfig> methods); ServiceBuilder<U> provider(ProviderConfig provider); ServiceBuilder<U> providerIds(String providerIds); ServiceBuilder<U> generic(String generic); ServiceConfig<U> build();  }
@Test void build() { MethodConfig method = new MethodConfig(); ProviderConfig provider = new ProviderConfig(); ServiceBuilder builder = new ServiceBuilder(); builder.path("path").addMethod(method).provider(provider).providerIds("providerIds") .generic(GENERIC_SERIALIZATION_DEFAULT); ServiceConfig config = builder.build(); ServiceConfig config2 = builder.build(); assertThat(config.getGeneric(), equalTo(GENERIC_SERIALIZATION_DEFAULT)); Assertions.assertEquals("path", config.getPath()); Assertions.assertEquals("providerIds", config.getProviderIds()); Assertions.assertSame(provider, config.getProvider()); Assertions.assertTrue(config.getMethods().contains(method)); Assertions.assertEquals(1, config.getMethods().size()); Assertions.assertNotSame(config, config2); }