### Question:
LabelFallbackHandler { public String fallback(String field, boolean replaceUnderscore, boolean replaceUppercaseInWord, boolean capitalizeAll) { String result = null; if (StringUtils.isNotBlank(field)) { if (replaceUppercaseInWord) { result = capitalize(deCamelCase(field), false); } if (replaceUnderscore) { result = capitalize(deUnderScore(result != null ? result : field), capitalizeAll); } } return result; } @Inject  LabelFallbackHandler(UIMappingConfig uiMappingConfig); String fallbackIfRequired(String field, String label, boolean replaceUnderscore,
                                   boolean replaceUppercaseInWord, boolean capitalizeAll); String fallbackIfRequired(String field, String label, boolean replaceUnderscore,
                                   boolean replaceUppercaseInWord, boolean capitalizeAll, List<String> prefixesToRemove, List<String> suffixesToRemove); String fallback(String field, boolean replaceUnderscore, boolean replaceUppercaseInWord, boolean capitalizeAll); String fallback(String field, boolean replaceUnderscore, boolean replaceUppercaseInWord, boolean capitalizeAll,
                         List<String> prefixesToRemove,  List<String> suffixesToRemove); boolean isEnabled();  }### Answer:
@Test public void testFallbackUnderscore() { String testInput = "my_field"; String result = underTest.fallback(testInput, true, false, true); assertEquals("My Field", result); }
@Test public void testFallbackUnderscoreWithNull() { String result = underTest.fallback(null, true, false, true); assertNull(result); }
@Test public void testFallbackCamelCase() { String testInput = "myField"; String result = underTest.fallback(testInput, false, true, true); assertEquals("My Field", result); }
@Test public void testFallbackCamelCaseWithEmptyString() { String testInput = ""; String result = underTest.fallback(testInput, true, true, true); assertNull(result); }
@Test public void testFallbackCamelCaseWithNull() { String result = underTest.fallback(null, true, true, true); assertNull(result); }
@Test public void testFallbackCamelCaseWith1Letter() { String testInput = "d"; String result = underTest.fallback(testInput, true, true, true); assertEquals("D", result); }
@Test public void testFallbackWithRemovingPrefixes() { String testInput1 = "ws_request_id"; String testInput2 = "std_request_username"; String result1 = underTest.fallback(testInput1, true, true, true, Arrays.asList("ws_", "std_"), null); String result2 = underTest.fallback(testInput2, true, true, true, Arrays.asList("ws_", "std_"), null); assertEquals("Request Id", result1); assertEquals("Request Username", result2); }
@Test public void testFallbackWithRemovingSuffixes() { String testInput1 = "request_id_i"; String testInput2 = "request_username_s"; String result1 = underTest.fallback(testInput1, true, true, true, null, Arrays.asList("_i", "_s")); String result2 = underTest.fallback(testInput2, true, true, true, null, Arrays.asList("_i", "_s")); assertEquals("Request Id", result1); assertEquals("Request Username", result2); }
@Test public void testFallbackWithRemovingPrefixesWithoutAnyPrefix() { String testInput = "request_id"; String result = underTest.fallback(testInput, true, true, true, Arrays.asList("ws_", "std_"), null); assertEquals("Request Id", result); }