MetadataReportBuilder extends AbstractBuilder<MetadataReportConfig, MetadataReportBuilder> { public MetadataReportConfig build() { MetadataReportConfig metadataReport = new MetadataReportConfig(); super.build(metadataReport); metadataReport.setAddress(address); metadataReport.setUsername(username); metadataReport.setPassword(password); metadataReport.setTimeout(timeout); metadataReport.setGroup(group); metadataReport.setParameters(parameters); metadataReport.setRetryTimes(retryTimes); metadataReport.setRetryPeriod(retryPeriod); metadataReport.setCycleReport(cycleReport); metadataReport.setSyncReport(syncReport); return metadataReport; }  static MetadataReportBuilder newBuilder(); MetadataReportBuilder address(String address); MetadataReportBuilder username(String username); MetadataReportBuilder password(String password); MetadataReportBuilder timeout(Integer timeout); MetadataReportBuilder group(String group); MetadataReportBuilder appendParameters(Map<String, String> appendParameters); MetadataReportBuilder appendParameter(String key, String value); MetadataReportBuilder retryTimes(Integer retryTimes); MetadataReportBuilder retryPeriod(Integer retryPeriod); MetadataReportBuilder cycleReport(Boolean cycleReport); MetadataReportBuilder syncReport(Boolean syncReport); MetadataReportConfig build();  }
@Test void build() { MetadataReportBuilder builder = new MetadataReportBuilder(); builder.address("address").username("username").password("password").timeout(1000).group("group") .retryTimes(1).retryPeriod(2).cycleReport(true).syncReport(false) .appendParameter("default.num", "one").id("id").prefix("prefix"); MetadataReportConfig config = builder.build(); MetadataReportConfig config2 = builder.build(); Assertions.assertTrue(config.getCycleReport()); Assertions.assertFalse(config.getSyncReport()); Assertions.assertEquals(1000, config.getTimeout()); Assertions.assertEquals(1, config.getRetryTimes()); Assertions.assertEquals(2, config.getRetryPeriod()); Assertions.assertEquals("address", config.getAddress()); Assertions.assertEquals("username", config.getUsername()); Assertions.assertEquals("password", config.getPassword()); Assertions.assertEquals("group", config.getGroup()); 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); }