### Question:
JavaUtil { public static String nameToJavaConst(String nameToConvert) { StringBuilder constName = new StringBuilder(); for (int i = 0; i < nameToConvert.length(); i++) { char currentChar = nameToConvert.charAt(i); if (Character.isUpperCase(currentChar) && i > 0) { char lastChar = nameToConvert.charAt(i - 1); if (Character.isLowerCase(lastChar)) { constName.append('_'); } } constName.append(Character.toUpperCase(currentChar)); } return constName.toString(); }  static String sqlNameToJavaVariableName(String name); static String nameToJavaConst(String nameToConvert); static String createTablePackageName(String packageBase, String tableClassName); static String createTableImport(String packageBase, String tableClassName);  }### Answer:
@Test public void testNameToJavaConst() throws Exception { assertEquals("TEST", JavaUtil.nameToJavaConst("test")); assertEquals("TEST123", JavaUtil.nameToJavaConst("test123")); assertEquals("MAIN_DATABASE", JavaUtil.nameToJavaConst("mainDatabase")); assertEquals("MAIN_DATABASE", JavaUtil.nameToJavaConst("MainDatabase")); assertEquals("MAIN_DATABASE", JavaUtil.nameToJavaConst("main_database")); }