LevenshteinTextSummary { public static Word[] prepareStringToken(String str) { if (str == null) { return new Word[0]; } final ArrayList<Word> strWithDelim = new ArrayList<Word>(); splitWordBySpace(str, strWithDelim); final Word[] toRet = new Word[Math.min(strWithDelim.size(), MAX_NUM_WORDS)]; for (int i = 0; i < Math.min(strWithDelim.size(), MAX_NUM_WORDS); i++) { toRet[i] = strWithDelim.get(i); } return toRet; } private  LevenshteinTextSummary(); static int getThreshold(); static void setThreshold(int threshold); static Word[] prepareString(String str); static Word[] prepareStringToken(String str); static String summarizeStrings(String first, String second); static int calcDistance(String strA, String strB); static int calcDistance(Word[] wordsA, Word[] wordsB);  }
@Test public void testPrepareStringStringBoolean() { final String str1 = "The rain IS in Spain."; final Word[] words = LevenshteinTextSummary.prepareStringToken(str1); assertEquals("The amount of output words should be the same.", expectedWords1.length, words.length); for (int i=0; i < expectedWords1.length; i++) { assertEquals("Make sure each word matches.", expectedWords1[i], words[i].getStr()); } }
@Test public void testPrepareStringStringBooleanWithCONT() { final String str1 = "The rain IS in Spain. (CONT.) Yup"; final Word[] words = LevenshteinTextSummary.prepareStringToken(str1); assertEquals("The amount of output words should be the same.", expectedWords2.length, words.length); for (int i=0; i < expectedWords2.length; i++) { assertEquals("Make sure each word matches.", expectedWords2[i], words[i].getStr()); } }
@Test public void testPrepareStringStringBooleanWithDirectories() { final String str1 = "dir1/dir2/dir3"; final String expected = str1; final Word[] words = LevenshteinTextSummary.prepareStringToken(str1); assertEquals("There should only be one word.", 1,words.length); assertEquals("The input should be the same as the expected output.", expected ,words[0].getStr()); }