case-sensitive first letter shouldn't oblige to use humps everywhere

This commit is contained in:
peter
2012-07-31 14:03:30 +02:00
parent 9b43857922
commit a8405ad41b
2 changed files with 7 additions and 6 deletions
@@ -372,11 +372,12 @@ public class NameUtilTest extends UsefulTestCase {
}
public void testMinusculeFirstLetter() {
assertTrue(new MinusculeMatcher("WebLogic", NameUtil.MatchingCaseSensitivity.FIRST_LETTER).matches("WebLogic"));
assertFalse(new MinusculeMatcher("webLogic", NameUtil.MatchingCaseSensitivity.FIRST_LETTER).matches("WebLogic"));
assertTrue(new MinusculeMatcher("cL", NameUtil.MatchingCaseSensitivity.FIRST_LETTER).matches("class"));
assertTrue(new MinusculeMatcher("CL", NameUtil.MatchingCaseSensitivity.FIRST_LETTER).matches("Class"));
assertFalse(new MinusculeMatcher("abc", NameUtil.MatchingCaseSensitivity.FIRST_LETTER).matches("_abc"));
assertTrue(firstLetterMatcher("WebLogic").matches("WebLogic"));
assertFalse(firstLetterMatcher("webLogic").matches("WebLogic"));
assertTrue(firstLetterMatcher("cL").matches("class"));
assertTrue(firstLetterMatcher("CL").matches("Class"));
assertTrue(firstLetterMatcher("Cl").matches("CoreLoader"));
assertFalse(firstLetterMatcher("abc").matches("_abc"));
}
public void testMinusculeAllImportant() {
@@ -40,7 +40,7 @@ public class MinusculeMatcher implements Matcher {
myPattern = StringUtil.trimEnd(pattern, "* ").toCharArray();
for (int i = 0; i < myPattern.length; i++) {
char c = myPattern[i];
if (Character.isUpperCase(c)) {
if (Character.isUpperCase(c) && (i > 0 || myOptions != FIRST_LETTER)) {
myHasHumps = true;
return;
}