Utils { public static String uppercaseFirstLetter(String input) { if (isNullOrEmpty(input)) return input; char[] value = input.toCharArray(); value[0] = Character.toUpperCase(value[0]); return new String(value); }  static boolean isNull(Object object); static boolean atLeastOneIsNull(Object... objects); static K instantiate(Class<K> objectClass); @SuppressWarnings("unchecked") static K instantiate(TypeReference<K> typeRef); static boolean containsIgnoreCase(Collection<String> strings, String value); static boolean equalsIgnoreCase(List<String> list1, List<String> list2); static StackTraceElement getStackTraceElement(); static StackTraceElement getParentStackTraceElement(); static StackTraceElement getGrandParentStackTraceElement(); static boolean isNullOrEmpty(String string); static boolean atLeastOneIsNullOrEmpty(String... strings); static String join(CharSequence delimiter, CharSequence... elements); static String join(CharSequence delimiter, Iterable<? extends CharSequence> elements); static String concat(Object... objects); static String[] splitByDot(String s); static String[] splitBySlash(String s); static String[] splitByDash(String s); static String[] split(String s, String regex); static String trimPreffix(String s, String preffix); static String trimUntil(String s, String until); static String trimBefore(String s, String before); static String trimSuffix(String s, String suffix); static String trimFrom(String s, String from); static String trimAfter(String s, String after); static String replaceTagDelimiters(String s); static String slugify(String input); static String uppercaseFirstLetter(String input); static String toUri(String[] uriTerms); static boolean isDigit(char c); static boolean isNullOrEmpty(Collection<?> collection); static boolean isNullOrEmpty(Map<?, ?> map); static boolean isNullOrEmpty(T[] array); static void info(); static void info(String message, Object... arguments); static void infoNoLn(String message, Object... arguments); static void info(String nodeName, JsonNode node); static void warn(String message, Object... arguments); static void warn(String message, Throwable t); static String[] toArray(String... parts); static Object[] toArray(Object... parts); static void closeSilently(AutoCloseable closeable); static byte[] toByteArray(InputStream stream); static final Charset UTF8; static final char UTF8_BOM; }
@Test public void shouldUppercaseFirstLetter() { assertEquals("Foobar", Utils.uppercaseFirstLetter("foobar")); assertEquals("Étable", Utils.uppercaseFirstLetter("étable")); assertEquals("-foobar", Utils.uppercaseFirstLetter("-foobar")); assertEquals(" foobar", Utils.uppercaseFirstLetter(" foobar")); }