StringTools { public static String processMpaaCertification(String mpaaCertification) { return processMpaaCertification(MPPA_RATED, mpaaCertification); } private  StringTools(); static String characterMapReplacement(Character charToReplace); static String stringMapReplacement(String stringToReplace); static String appendToPath(final String basePath, final String additionalPath); static String cleanString(String sourceString); static String formatFileSize(long fileSize); static boolean isNotValidString(String testString); static boolean isValidString(String testString); static String trimToLength(String sourceString, int requiredLength); static String trimToLength(String sourceString, int requiredLength, boolean trimToWord, String endingSuffix); static List<T> castList(Class<? extends T> objClass, Collection<?> c); static List<String> splitList(String stringToSplit, String regexDelim); static String[] tokenizeToArray(String sourceString, String delimiter); static String processMpaaCertification(String mpaaCertification); static String processMpaaCertification(String mpaaRated, String mpaaCertification); static String replaceQuotes(String original); static int parseRating(String rating); static int parseRating(float rating); static String getWords(final String sentanceToTrim, int numOfWords);  }
@Test public void testProcessMpaaCertification() { LOG.info("processMpaaCertification"); String mpaa = "Certificate 12 for something silly"; String result = StringTools.processMpaaCertification("Certificate", mpaa); assertEquals("12", result); Map<String, String> certs = new HashMap<>(); certs.put("Rated PG-13 for some violent images and brief nudity", "PG-13"); certs.put("Rated R for some violence (Redux version)", "R"); for (Map.Entry<String, String> entry : certs.entrySet()) { LOG.info("Checking '{}'", entry.getKey()); result = StringTools.processMpaaCertification(entry.getKey()); assertEquals("Failed to get correct certification", entry.getValue(), result); } }