### Question:
NameCutter { public String trimByDictionary(String name) { String result = ""; String[] nameParts = StringUtils.splitByCharacterTypeCamelCase(name); for (int i = 0; i < nameParts.length; i++) { String namePart = nameParts[i]; for (String word : dictionary.keySet()) { if (namePart.equalsIgnoreCase(word)) { logger.debug("dictionary Hit at '{}' result '{}'", name, name.replaceAll(word, dictionary.get(word))); nameParts[i] = dictionary.get(word); } } } for (String namePart : nameParts) { result = result + namePart; } return result; }  String trimByCamelCase(String name, Integer maxLength); String trimByDictionary(String name); Map<String, String> getDictionary(); void setDictionary(Map<String, String> dictionary);  }### Answer:
@Test public void testTrimByDictionary() { Assert.assertEquals("Blo", nameCutter.trimByDictionary("Bloom")); Assert.assertEquals("Tok", nameCutter.trimByDictionary("Token")); Assert.assertEquals("CommitVirtMemSize", nameCutter.trimByDictionary("CommittedVirtualMemorySize")); Assert.assertEquals("AvgCompRatio" , nameCutter.trimByDictionary("AverageCompressionRatio")); Assert.assertEquals("AllIdntToknzCnt" , nameCutter.trimByDictionary("AllIdentityTokenizedCount")); }