MethodBuilder extends AbstractMethodBuilder<MethodConfig, MethodBuilder> { public MethodConfig build() { MethodConfig methodConfig = new MethodConfig(); super.build(methodConfig); methodConfig.setArguments(arguments); methodConfig.setDeprecated(deprecated); methodConfig.setExecutes(executes); methodConfig.setName(name); methodConfig.setOninvoke(oninvoke); methodConfig.setOninvokeMethod(oninvokeMethod); methodConfig.setOnreturn(onreturn); methodConfig.setOnreturnMethod(onreturnMethod); methodConfig.setOnthrow(onthrow); methodConfig.setOnthrowMethod(onthrowMethod); methodConfig.setReturn(isReturn); methodConfig.setService(service); methodConfig.setServiceId(serviceId); methodConfig.setSticky(sticky); methodConfig.setReliable(reliable); methodConfig.setStat(stat); methodConfig.setRetry(retry); return methodConfig; }  MethodBuilder name(String name); MethodBuilder stat(Integer stat); MethodBuilder retry(Boolean retry); MethodBuilder reliable(Boolean reliable); MethodBuilder executes(Integer executes); MethodBuilder deprecated(Boolean deprecated); MethodBuilder sticky(Boolean sticky); MethodBuilder isReturn(Boolean isReturn); MethodBuilder oninvoke(Object oninvoke); MethodBuilder oninvokeMethod(String oninvokeMethod); MethodBuilder onreturn(Object onreturn); MethodBuilder onreturnMethod(String onreturnMethod); MethodBuilder onthrow(Object onthrow); MethodBuilder onthrowMethod(String onthrowMethod); MethodBuilder addArguments(List<? extends ArgumentConfig> arguments); MethodBuilder addArgument(ArgumentConfig argument); MethodBuilder service(String service); MethodBuilder serviceId(String serviceId); MethodConfig build();  }
@Test void build() { ArgumentConfig argument = new ArgumentConfig(); MethodBuilder builder = new MethodBuilder(); builder.name("name").stat(1).retry(true).reliable(false).executes(2).deprecated(true).sticky(false) .isReturn(true).oninvoke("on-invoke-object").oninvokeMethod("on-invoke-method").service("service") .onreturn("on-return-object").onreturnMethod("on-return-method").serviceId("serviceId") .onthrow("on-throw-object").onthrowMethod("on-throw-method").addArgument(argument); MethodConfig config = builder.build(); MethodConfig config2 = builder.build(); Assertions.assertTrue(config.isRetry()); Assertions.assertFalse(config.isReliable()); Assertions.assertTrue(config.getDeprecated()); Assertions.assertFalse(config.getSticky()); Assertions.assertTrue(config.isReturn()); Assertions.assertEquals(1, config.getStat()); Assertions.assertEquals(2, config.getExecutes()); Assertions.assertEquals("on-invoke-object", config.getOninvoke()); Assertions.assertEquals("on-invoke-method", config.getOninvokeMethod()); Assertions.assertEquals("on-return-object", config.getOnreturn()); Assertions.assertEquals("on-return-method", config.getOnreturnMethod()); Assertions.assertEquals("on-throw-object", config.getOnthrow()); Assertions.assertEquals("on-throw-method", config.getOnthrowMethod()); Assertions.assertEquals("name", config.getName()); Assertions.assertEquals("service", config.getService()); Assertions.assertEquals("serviceId", config.getServiceId()); Assertions.assertNotSame(config, config2); }