AbstractBuilder { protected void build(C instance) { if (!StringUtils.isEmpty(id)) { instance.setId(id); } if (!StringUtils.isEmpty(prefix)) { instance.setPrefix(prefix); } }  B id(String id); abstract C build();  }
@Test void build() { Builder builder = new Builder(); builder.id("id"); builder.prefix("prefix"); Config config = builder.build(); Config config2 = builder.build(); Assertions.assertEquals("id", config.getId()); Assertions.assertEquals("prefix", config.getPrefix()); Assertions.assertNotSame(config, config2); }