@Test public void testBuilds() { UseAllTypeNameValuesStringBuilder builder = new UseAllTypeNameValuesStringBuilder( TypeNameValuesStringBuilder.DEFAULT_SEPARATOR); assertThat(builder.build(null, "a=1")).isEqualTo("1"); assertThat(builder.build(Collections.<String>emptyList(), "a=1")).isEqualTo("1"); assertThat(builder.build(asList("x-key1-x"), "x-key1-x=x-value1-x")).isEqualTo("x-value1-x"); assertThat(builder.build(asList("x-key1-x"), "y-key2-y=y-value2-y")).isEqualTo("y-value2-y"); assertThat(builder.build(asList("y-key2-y", "x-key1-x"), "x-key1-x=x-value1-x,y-key2-y=y-value2-y")) .isEqualTo("x-value1-x_y-value2-y"); }
@Override public String build(List<String> typeNames, String typeNameStr) { List<String> allTypeNames = new ArrayList<>(); for (TypeNameValue typeNameValue : TypeNameValue.extract(typeNameStr)){ if (typeNameValue.getValue() != null && !typeNameValue.getValue().isEmpty()) { allTypeNames.add(typeNameValue.getKey()); } } return doBuild(allTypeNames, typeNameStr); }
UseAllTypeNameValuesStringBuilder extends TypeNameValuesStringBuilder { @Override public String build(List<String> typeNames, String typeNameStr) { List<String> allTypeNames = new ArrayList<>(); for (TypeNameValue typeNameValue : TypeNameValue.extract(typeNameStr)){ if (typeNameValue.getValue() != null && !typeNameValue.getValue().isEmpty()) { allTypeNames.add(typeNameValue.getKey()); } } return doBuild(allTypeNames, typeNameStr); } }
UseAllTypeNameValuesStringBuilder extends TypeNameValuesStringBuilder { @Override public String build(List<String> typeNames, String typeNameStr) { List<String> allTypeNames = new ArrayList<>(); for (TypeNameValue typeNameValue : TypeNameValue.extract(typeNameStr)){ if (typeNameValue.getValue() != null && !typeNameValue.getValue().isEmpty()) { allTypeNames.add(typeNameValue.getKey()); } } return doBuild(allTypeNames, typeNameStr); } UseAllTypeNameValuesStringBuilder(String separator); }
UseAllTypeNameValuesStringBuilder extends TypeNameValuesStringBuilder { @Override public String build(List<String> typeNames, String typeNameStr) { List<String> allTypeNames = new ArrayList<>(); for (TypeNameValue typeNameValue : TypeNameValue.extract(typeNameStr)){ if (typeNameValue.getValue() != null && !typeNameValue.getValue().isEmpty()) { allTypeNames.add(typeNameValue.getKey()); } } return doBuild(allTypeNames, typeNameStr); } UseAllTypeNameValuesStringBuilder(String separator); @Override String build(List<String> typeNames, String typeNameStr); }
UseAllTypeNameValuesStringBuilder extends TypeNameValuesStringBuilder { @Override public String build(List<String> typeNames, String typeNameStr) { List<String> allTypeNames = new ArrayList<>(); for (TypeNameValue typeNameValue : TypeNameValue.extract(typeNameStr)){ if (typeNameValue.getValue() != null && !typeNameValue.getValue().isEmpty()) { allTypeNames.add(typeNameValue.getKey()); } } return doBuild(allTypeNames, typeNameStr); } UseAllTypeNameValuesStringBuilder(String separator); @Override String build(List<String> typeNames, String typeNameStr);  }