StringUtils { public static String capitalize(String expression) { return Objects.requireNonNull(expression, "String value cannot be null").isEmpty() ? expression : expression.substring(0, 1).toUpperCase() + expression.substring(1); } private  StringUtils(); static String uncapitalize(String expression); static String capitalize(String expression);  }
@Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "String value cannot be null") public void testCapitalizingNullValue() { StringUtils.capitalize(null); }
@Test public void testCapitalizingEmptyString() { assertThat(StringUtils.capitalize(""), is("")); }
@Test public void testCapitalizingUncapitalizedString() { assertThat(StringUtils.capitalize("hello"), is("Hello")); }
@Test public void testCapitalizingCapitalizedString() { assertThat(StringUtils.capitalize("Hello"), is("Hello")); }