AbstractMethodBuilder extends AbstractBuilder<T, B> { @Override @SuppressWarnings("unchecked") public void build(T instance) { super.build(instance); if (actives != null) { instance.setActives(actives); } if (async != null) { instance.setAsync(async); } if (!StringUtils.isEmpty(cache)) { instance.setCache(cache); } if (forks != null) { instance.setForks(forks); } if (!StringUtils.isEmpty(loadbalance)) { instance.setLoadbalance(loadbalance); } if (!StringUtils.isEmpty(merger)) { instance.setMerger(merger); } if(!StringUtils.isEmpty(mock)) { instance.setMock(mock); } if (retries != null) { instance.setRetries(retries); } if (sent != null) { instance.setSent(sent); } if (timeout != null) { instance.setTimeout(timeout); } if (!StringUtils.isEmpty(validation)) { instance.setValidation(validation); } if (parameters != null) { instance.setParameters(parameters); } }  B timeout(Integer timeout); B retries(Integer retries); B actives(Integer actives); B loadbalance(String loadbalance); B async(Boolean async); B sent(Boolean sent); B mock(String mock); B mock(Boolean mock); B merger(String merger); B cache(String cache); B validation(String validation); B appendParameters(Map<String, String> appendParameters); B appendParameter(String key, String value); B forks(Integer forks); @Override @SuppressWarnings("unchecked") void build(T instance);  }
@Test void build() { MethodBuilder builder = new MethodBuilder(); builder.id("id").prefix("prefix").timeout(1).retries(2).actives(3).loadbalance("mockloadbalance").async(true) .sent(false).mock("mock").merger("merger").cache("cache").validation("validation") .appendParameter("default.num", "one"); MethodConfig config = builder.build(); MethodConfig config2 = builder.build(); Assertions.assertEquals("id", config.getId()); Assertions.assertEquals("prefix", config.getPrefix()); Assertions.assertEquals(1, config.getTimeout()); Assertions.assertEquals(2, config.getRetries()); Assertions.assertEquals(3, config.getActives()); Assertions.assertEquals("mockloadbalance", config.getLoadbalance()); Assertions.assertTrue(config.isAsync()); Assertions.assertFalse(config.getSent()); Assertions.assertEquals("mock", config.getMock()); Assertions.assertEquals("merger", config.getMerger()); Assertions.assertEquals("cache", config.getCache()); Assertions.assertEquals("validation", config.getValidation()); Assertions.assertTrue(config.getParameters().containsKey("default.num")); Assertions.assertEquals("one", config.getParameters().get("default.num")); Assertions.assertNotSame(config, config2); }