RegistryBuilder extends AbstractBuilder<RegistryConfig, RegistryBuilder> { public RegistryConfig build() { RegistryConfig registry = new RegistryConfig(); super.build(registry); registry.setCheck(check); registry.setClient(client); registry.setCluster(cluster); registry.setDefault(isDefault); registry.setDynamic(dynamic); registry.setExtraKeys(extraKeys); registry.setFile(file); registry.setGroup(group); registry.setParameters(parameters); registry.setPassword(password); registry.setPort(port); registry.setProtocol(protocol); registry.setRegister(register); registry.setServer(server); registry.setSession(session); registry.setSimplified(simplified); registry.setSubscribe(subscribe); registry.setTimeout(timeout); registry.setTransporter(transporter); registry.setUsername(username); registry.setVersion(version); registry.setWait(wait); registry.setUseAsConfigCenter(useAsConfigCenter); registry.setUseAsMetadataCenter(useAsMetadataCenter); registry.setAccepts(accepts); registry.setPreferred(preferred); registry.setWeight(weight); registry.setAddress(address); return registry; }  static RegistryBuilder newBuilder(); RegistryBuilder id(String id); RegistryBuilder address(String address); RegistryBuilder username(String username); RegistryBuilder password(String password); RegistryBuilder port(Integer port); RegistryBuilder protocol(String protocol); RegistryBuilder transporter(String transporter); @Deprecated RegistryBuilder transport(String transport); RegistryBuilder server(String server); RegistryBuilder client(String client); RegistryBuilder cluster(String cluster); RegistryBuilder group(String group); RegistryBuilder version(String version); RegistryBuilder timeout(Integer timeout); RegistryBuilder session(Integer session); RegistryBuilder file(String file); @Deprecated RegistryBuilder wait(Integer wait); RegistryBuilder isCheck(Boolean check); RegistryBuilder isDynamic(Boolean dynamic); RegistryBuilder register(Boolean register); RegistryBuilder subscribe(Boolean subscribe); RegistryBuilder appendParameter(String key, String value); RegistryBuilder parameter(String name, String value); RegistryBuilder appendParameters(Map<String, String> appendParameters); RegistryBuilder isDefault(Boolean isDefault); RegistryBuilder simplified(Boolean simplified); RegistryBuilder extraKeys(String extraKeys); RegistryBuilder useAsConfigCenter(Boolean useAsConfigCenter); RegistryBuilder useAsMetadataCenter(Boolean useAsMetadataCenter); RegistryBuilder preferred(Boolean preferred); RegistryBuilder accepts(String accepts); RegistryBuilder weight(Integer weight); RegistryConfig build();  }
@Test void build() { RegistryBuilder builder = new RegistryBuilder(); builder.address("address").username("username").password("password").port(8080).protocol("protocol") .transporter("transporter").server("server").client("client").cluster("cluster").group("group") .version("version").timeout(1000).session(2000).file("file").wait(Integer.valueOf(10)).isCheck(true) .isDynamic(false).register(true).subscribe(false).isDefault(true).simplified(false).extraKeys("A") .parameter("default.num", "one").id("id").prefix("prefix"); RegistryConfig config = builder.build(); RegistryConfig config2 = builder.build(); Assertions.assertEquals(8080, config.getPort()); Assertions.assertEquals(1000, config.getTimeout()); Assertions.assertEquals(2000, config.getSession()); Assertions.assertEquals(10, config.getWait()); Assertions.assertTrue(config.isCheck()); Assertions.assertFalse(config.isDynamic()); Assertions.assertTrue(config.isRegister()); Assertions.assertFalse(config.isSubscribe()); Assertions.assertTrue(config.isDefault()); Assertions.assertFalse(config.getSimplified()); Assertions.assertEquals("address", config.getAddress()); Assertions.assertEquals("username", config.getUsername()); Assertions.assertEquals("password", config.getPassword()); Assertions.assertEquals("protocol", config.getProtocol()); Assertions.assertEquals("transporter", config.getTransporter()); Assertions.assertEquals("server", config.getServer()); Assertions.assertEquals("client", config.getClient()); Assertions.assertEquals("cluster", config.getCluster()); Assertions.assertEquals("group", config.getGroup()); Assertions.assertEquals("version", config.getVersion()); Assertions.assertEquals("file", config.getFile()); Assertions.assertEquals("A", config.getExtraKeys()); Assertions.assertTrue(config.getParameters().containsKey("default.num")); Assertions.assertEquals("one", config.getParameters().get("default.num")); Assertions.assertEquals("id", config.getId()); Assertions.assertEquals("prefix", config.getPrefix()); Assertions.assertNotSame(config, config2); }