BusinessRejectReasonText extends BusinessRejectReason { static String toText(String constName) { StringBuilder sb = new StringBuilder(constName.toLowerCase()); boolean upper = true; for (int i = 0; i < sb.length(); i++) { if (upper) { sb.setCharAt(i, Character.toUpperCase(sb.charAt(i))); upper = false; } if (sb.charAt(i) == '_') { sb.setCharAt(i, ' '); upper = true; } } return sb.toString(); }  static String getMessage(int rejectReason);  }
@Test public void testToText() { assertEquals("Other", BusinessRejectReasonText.toText("OTHER")); assertEquals("Other", BusinessRejectReasonText.toText("other")); assertEquals("Other Reason", BusinessRejectReasonText.toText("OTHER_REASON")); assertEquals("Another Other Reason", BusinessRejectReasonText.toText("ANOTHER_OTHER_REASON")); }