Permalink
Browse files

User parameterized with ignoring case, fix bug.

  • Loading branch information...
1 parent ffc05d6 commit 161c101b3d7d3aecfc82dc428f28ad1541730ca2 @designatednerd committed May 20, 2015
@@ -79,4 +79,10 @@ public void findCommonLetters() {
String foundCommonLetters = mLetterFinder.commonLetters(mFirstString, mSecondString);
assertEquals(mExpectedCommonLetters, foundCommonLetters);
}
+
+ @Test
+ public void findCommonLettersIgnoringCase() {
+ String foundCommonLetters = mLetterFinder.commonLettersCaseInsensitive(mFirstString, mSecondString);
+ assertEquals(mExpectedCommonLetters, foundCommonLetters);
+ }
}
@@ -31,6 +31,10 @@ public String commonLetters(String aFirstString, String aSecondString) {
}
public String commonLettersCaseInsensitive(String aFirstString, String aSecondString) {
- return commonLetters(aFirstString.toLowerCase(), aSecondString.toLowerCase());
+ if (aFirstString != null && aSecondString != null) {
+ return commonLetters(aFirstString.toLowerCase(), aSecondString.toLowerCase());
+ } else {
+ return null;
+ }
}
}

0 comments on commit 161c101

Please sign in to comment.