@ParameterizedTest @ArgumentsSource(TestCaseArgumentsProvider.class) @NullValue("<NULL>") @TestCase({"<NULL>", ""}) @TestCase({"", ""}) @TestCase({"a", "A"}) @TestCase({"B", "B"}) @TestCase({"abc", "ABC"}) @TestCase({" def", " DEF"}) @TestCase({"aBC", "A_BC"}) @TestCase({"camelCase", "CAMEL_CASE"}) @TestCase({"camelCaseWithTLA", "CAMEL_CASE_WITH_TLA"}) @TestCase({"camelCaseWithTLAInMiddle", "CAMEL_CASE_WITH_TLA_IN_MIDDLE"}) @TestCase({"tlaAtStart", "TLA_AT_START"}) @TestCase({"NotCamelCase", "NOT_CAMEL_CASE"}) @TestCase({"TLANotCamelCase", "TLA_NOT_CAMEL_CASE"}) void camelToUpper(String input, String expectedResult) { assertThat(StringUtil.camelToUpper(input), is(expectedResult)); }
public static String camelToUpper(String camelName) { if (StringUtils.isEmpty(camelName)) { return ""; } return Arrays.stream(camelName.split("(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])")) .filter(StringUtils::isNotBlank) .map(String::toUpperCase) .collect(joining("_")); }
StringUtil extends UtilityClass { public static String camelToUpper(String camelName) { if (StringUtils.isEmpty(camelName)) { return ""; } return Arrays.stream(camelName.split("(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])")) .filter(StringUtils::isNotBlank) .map(String::toUpperCase) .collect(joining("_")); } }
StringUtil extends UtilityClass { public static String camelToUpper(String camelName) { if (StringUtils.isEmpty(camelName)) { return ""; } return Arrays.stream(camelName.split("(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])")) .filter(StringUtils::isNotBlank) .map(String::toUpperCase) .collect(joining("_")); }  }
StringUtil extends UtilityClass { public static String camelToUpper(String camelName) { if (StringUtils.isEmpty(camelName)) { return ""; } return Arrays.stream(camelName.split("(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])")) .filter(StringUtils::isNotBlank) .map(String::toUpperCase) .collect(joining("_")); }  static String lowercaseFirst(String s); static String uppercaseFirst(String s); static String camelToUpper(String camelName); static String hex(byte... bytes); static String octal(byte... bytes); static Function<T,String> prepend(String arg); static Function<T,String> append(String arg); }
StringUtil extends UtilityClass { public static String camelToUpper(String camelName) { if (StringUtils.isEmpty(camelName)) { return ""; } return Arrays.stream(camelName.split("(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])")) .filter(StringUtils::isNotBlank) .map(String::toUpperCase) .collect(joining("_")); }  static String lowercaseFirst(String s); static String uppercaseFirst(String s); static String camelToUpper(String camelName); static String hex(byte... bytes); static String octal(byte... bytes); static Function<T,String> prepend(String arg); static Function<T,String> append(String arg);  }