public void testEmptyString() {
assertEqualsLongestRepeatingSubstring("", "");
assertEqualsLongestRepeatingSubstring("", " ");
assertEqualsLongestRepeatingSubstring(" ", " ");
assertEqualsLongestRepeatingSubstring(" ", " ");
}
public void testOneRepetition() {
assertEqualsLongestRepeatingSubstring("", "a");
assertEqualsLongestRepeatingSubstring("a", "aa");
assertEqualsLongestRepeatingSubstring("a", "aba");
assertEqualsLongestRepeatingSubstring("a", "abba");
assertEqualsLongestRepeatingSubstring("a", "aab");
assertEqualsLongestRepeatingSubstring("a", "baa");
assertEqualsLongestRepeatingSubstring("a", "baab");
}
public void testNumerouslyRepetition(){
assertEqualsLongestRepeatingSubstring("aa", "aaa");
assertEqualsLongestRepeatingSubstring("ab", "abab");
assertEqualsLongestRepeatingSubstring("abab", "ababab");
assertEqualsLongestRepeatingSubstring("aa", "aaabbb");
assertEqualsLongestRepeatingSubstring("aa", "bbbaaa");
}
public void testConcretExample() {
assertEqualsLongestRepeatingSubstring("issi", "Mississippi");
}
private void assertEqualsLongestRepeatingSubstring(String expected, String actual){
assertEquals(expected, RefactoringBeispiel2.longestRepeatingSubstring(actual));
} |