AbstractServiceBuilder extends AbstractInterfaceBuilder<T, B> { @Override public void build(T instance) { super.build(instance); if (!StringUtils.isEmpty(version)) { instance.setVersion(version); } if (!StringUtils.isEmpty(group)) { instance.setGroup(group); } if (deprecated != null) { instance.setDeprecated(deprecated); } if (delay != null) { instance.setDelay(delay); } if (export != null) { instance.setExport(export); } if (weight != null) { instance.setWeight(weight); } if (!StringUtils.isEmpty(document)) { instance.setDocument(document); } if (dynamic != null) { instance.setDynamic(dynamic); } if (!StringUtils.isEmpty(token)) { instance.setToken(token); } if (!StringUtils.isEmpty(accesslog)) { instance.setAccesslog(accesslog); } if (protocols != null) { instance.setProtocols(protocols); } if (!StringUtils.isEmpty(protocolIds)) { instance.setProtocolIds(protocolIds); } if (executes != null) { instance.setExecutes(executes); } if (register != null) { instance.setRegister(register); } if (warmup != null) { instance.setWarmup(warmup); } if (!StringUtils.isEmpty(serialization)) { instance.setSerialization(serialization); } }  B version(String version); B group(String group); B deprecated(Boolean deprecated); B delay(Integer delay); B export(Boolean export); B weight(Integer weight); B document(String document); B dynamic(Boolean dynamic); B token(String token); B token(Boolean token); B accesslog(String accesslog); B accesslog(Boolean accesslog); B addProtocols(List<ProtocolConfig> protocols); B addProtocol(ProtocolConfig protocol); B protocolIds(String protocolIds); B executes(Integer executes); B register(Boolean register); B warmup(Integer warmup); B serialization(String serialization); @Override void build(T instance);  }
@Test void tag() { ServiceBuilder builder = new ServiceBuilder(); builder.tag("tag"); Assertions.assertEquals("tag", builder.build().getTag()); }
@Test void build() { ProtocolConfig protocol = new ProtocolConfig(); ServiceBuilder builder = new ServiceBuilder(); builder.version("version").group("group").deprecated(true).delay(1000).export(false).weight(1) .document("document").dynamic(true).token("token").accesslog("accesslog") .addProtocol(protocol).protocolIds("protocolIds").tag("tag").executes(100).register(false) .warmup(200).serialization("serialization").id("id").prefix("prefix"); ServiceConfig config = builder.build(); ServiceConfig config2 = builder.build(); Assertions.assertEquals("id", config.getId()); Assertions.assertEquals("prefix", config.getPrefix()); Assertions.assertEquals("version", config.getVersion()); Assertions.assertEquals("group", config.getGroup()); Assertions.assertEquals("document", config.getDocument()); Assertions.assertEquals("token", config.getToken()); Assertions.assertEquals("accesslog", config.getAccesslog()); Assertions.assertEquals("protocolIds", config.getProtocolIds()); Assertions.assertEquals("tag", config.getTag()); Assertions.assertEquals("serialization", config.getSerialization()); Assertions.assertTrue(config.isDeprecated()); Assertions.assertFalse(config.getExport()); Assertions.assertTrue(config.isDynamic()); Assertions.assertFalse(config.isRegister()); Assertions.assertEquals(1000, config.getDelay()); Assertions.assertEquals(1, config.getWeight()); Assertions.assertEquals(100, config.getExecutes()); Assertions.assertEquals(200, config.getWarmup()); Assertions.assertNotSame(config, config2); }