### Question:
Expression { void format(String raw, StringBuilder builder) { if (format == null) { builder.append(raw); return; } for (int i = 0; i < format.length(); i++) { if (PLACEHOLDER == format.charAt(i)) { if (i + 1 < format.length() && PLACEHOLDER == format.charAt(i + 1)) { builder.append(PLACEHOLDER); i++; } else { builder.append(raw); } } else { builder.append(format.charAt(i)); } } } Expression(Evaluator evaluator, @Nullable String format, @Nullable String separator); String evaluate(Cluster cluster, Set<Node> clusterNodes, Node node); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void testFormatting() { String[] cases = { "", "", "$", "foo", "$$", "$", "$$$", "$foo", "$ $", "foo foo", "$:2181", "foo:2181", "http: }; for (int i = 0; i < cases.length; i += 2) { StringBuilder builder = new StringBuilder(); new Expression(null, cases[i], null).format("foo", builder); Assert.assertEquals(cases[i + 1], builder.toString()); } }