AbstractBuilder { protected static Map<String, String> appendParameter(Map<String, String> parameters, String key, String value) { if (parameters == null) { parameters = new HashMap<>(); } parameters.put(key, value); return parameters; }  B id(String id); abstract C build();  }
@Test void appendParameter() { Map<String, String> source = null; Map<String, String> parameters = new HashMap<>(); parameters.put("default.num", "one"); parameters.put("num", "ONE"); source = AbstractBuilder.appendParameters(source, parameters); Assertions.assertTrue(source.containsKey("default.num")); Assertions.assertEquals("ONE", source.get("num")); }
@Test void appendParameters2() { Map<String, String> source = new HashMap<>(); source.put("default.num", "one1"); source.put("num", "ONE1"); source = AbstractBuilder.appendParameter(source, "default.num", "one"); source = AbstractBuilder.appendParameter(source, "num", "ONE"); Assertions.assertTrue(source.containsKey("default.num")); Assertions.assertEquals("ONE", source.get("num")); }