LabelBuilder { private String capitalize(String str) { char[] buffer = str.toCharArray(); boolean capitalizeNext = true; for (int i = 0; i < buffer.length; i++) { char ch = buffer[i]; if (Character.isWhitespace(ch)) { capitalizeNext = true; } else if (capitalizeNext) { buffer[i] = Character.toUpperCase(ch); capitalizeNext = false; } } return new String(buffer); }  String label(Property property); String label(String name); String enumeration(Iterable<String> names, String conjunction);  }
@Test public void capitalize() { assertEquals("Background Validation", builder.label("background-validation")); assertEquals("Enabled", builder.label("enabled")); }