@Test(groups = "fast") public void testWithStudlyCaps() throws Exception { String input = "bugName"; String output = LocalizationUtility.makePseudoFriendlyName(input); Assert.assertEquals(output, "Bug Name"); }
public static String makePseudoFriendlyName(String fieldNameKey) { StringBuilder builder = new StringBuilder(fieldNameKey.length() + 10); char[] characters = fieldNameKey.toCharArray(); builder.append(Character.toUpperCase(characters[0])); boolean upcaseNextChar = false; for (int i = 1; i < characters.length; ++i) { if (characters[i] == '.') { builder.append(' '); upcaseNextChar = true; } else if (Character.isUpperCase(characters[i])) { builder.append(' ').append(characters[i]); upcaseNextChar = false; } else if (upcaseNextChar) { builder.append(Character.toUpperCase(characters[i])); upcaseNextChar = false; } else { builder.append(characters[i]); upcaseNextChar = false; } } return builder.toString(); }
LocalizationUtility { public static String makePseudoFriendlyName(String fieldNameKey) { StringBuilder builder = new StringBuilder(fieldNameKey.length() + 10); char[] characters = fieldNameKey.toCharArray(); builder.append(Character.toUpperCase(characters[0])); boolean upcaseNextChar = false; for (int i = 1; i < characters.length; ++i) { if (characters[i] == '.') { builder.append(' '); upcaseNextChar = true; } else if (Character.isUpperCase(characters[i])) { builder.append(' ').append(characters[i]); upcaseNextChar = false; } else if (upcaseNextChar) { builder.append(Character.toUpperCase(characters[i])); upcaseNextChar = false; } else { builder.append(characters[i]); upcaseNextChar = false; } } return builder.toString(); } }
LocalizationUtility { public static String makePseudoFriendlyName(String fieldNameKey) { StringBuilder builder = new StringBuilder(fieldNameKey.length() + 10); char[] characters = fieldNameKey.toCharArray(); builder.append(Character.toUpperCase(characters[0])); boolean upcaseNextChar = false; for (int i = 1; i < characters.length; ++i) { if (characters[i] == '.') { builder.append(' '); upcaseNextChar = true; } else if (Character.isUpperCase(characters[i])) { builder.append(' ').append(characters[i]); upcaseNextChar = false; } else if (upcaseNextChar) { builder.append(Character.toUpperCase(characters[i])); upcaseNextChar = false; } else { builder.append(characters[i]); upcaseNextChar = false; } } return builder.toString(); }  }
LocalizationUtility { public static String makePseudoFriendlyName(String fieldNameKey) { StringBuilder builder = new StringBuilder(fieldNameKey.length() + 10); char[] characters = fieldNameKey.toCharArray(); builder.append(Character.toUpperCase(characters[0])); boolean upcaseNextChar = false; for (int i = 1; i < characters.length; ++i) { if (characters[i] == '.') { builder.append(' '); upcaseNextChar = true; } else if (Character.isUpperCase(characters[i])) { builder.append(' ').append(characters[i]); upcaseNextChar = false; } else if (upcaseNextChar) { builder.append(Character.toUpperCase(characters[i])); upcaseNextChar = false; } else { builder.append(characters[i]); upcaseNextChar = false; } } return builder.toString(); }  static String getLocalizedFieldName(String fieldName,
            String actionPath,
            Class<? extends ActionBean> beanclass,
            Locale locale); static String makePseudoFriendlyName(String fieldNameKey); static String getErrorMessage(Locale locale, String key); static String getSimpleName(Class<?> c); }
LocalizationUtility { public static String makePseudoFriendlyName(String fieldNameKey) { StringBuilder builder = new StringBuilder(fieldNameKey.length() + 10); char[] characters = fieldNameKey.toCharArray(); builder.append(Character.toUpperCase(characters[0])); boolean upcaseNextChar = false; for (int i = 1; i < characters.length; ++i) { if (characters[i] == '.') { builder.append(' '); upcaseNextChar = true; } else if (Character.isUpperCase(characters[i])) { builder.append(' ').append(characters[i]); upcaseNextChar = false; } else if (upcaseNextChar) { builder.append(Character.toUpperCase(characters[i])); upcaseNextChar = false; } else { builder.append(characters[i]); upcaseNextChar = false; } } return builder.toString(); }  static String getLocalizedFieldName(String fieldName,
            String actionPath,
            Class<? extends ActionBean> beanclass,
            Locale locale); static String makePseudoFriendlyName(String fieldNameKey); static String getErrorMessage(Locale locale, String key); static String getSimpleName(Class<?> c);  }