[count-upper-lower] some renamings were missing

This commit is contained in:
Kai.Yuan 2024-02-02 17:30:15 +01:00
parent ee12253609
commit 746c6f5083
1 changed files with 10 additions and 10 deletions

View File

@ -9,34 +9,34 @@ public class CountUpperAndLowercaseCharsUnitTest {
@Test @Test
void whenIteratingCharArrayCompareAndCount_thenGetExpectedResult() { void whenIteratingCharArrayCompareAndCount_thenGetExpectedResult() {
int upperCnt = 0; int upperCount = 0;
int lowerCnt = 0; int lowerCount = 0;
for (char c : MY_STRING.toCharArray()) { for (char c : MY_STRING.toCharArray()) {
if (c >= 'A' && c <= 'Z') { if (c >= 'A' && c <= 'Z') {
upperCnt++; upperCount++;
} }
if (c >= 'a' && c <= 'z') { if (c >= 'a' && c <= 'z') {
lowerCnt++; lowerCount++;
} }
} }
LetterCount result = new LetterCount(upperCnt, lowerCnt); LetterCount result = new LetterCount(upperCount, lowerCount);
assertEquals(4, result.getUppercaseCount()); assertEquals(4, result.getUppercaseCount());
assertEquals(31, result.getLowercaseCount()); assertEquals(31, result.getLowercaseCount());
} }
@Test @Test
void whenUsingCharacterIsLowerOrUpperCase_thenGetExpectedResult() { void whenUsingCharacterIsLowerOrUpperCase_thenGetExpectedResult() {
int upperCnt = 0; int upperCount = 0;
int lowerCnt = 0; int lowerCount = 0;
for (char c : MY_STRING.toCharArray()) { for (char c : MY_STRING.toCharArray()) {
if (Character.isUpperCase(c)) { if (Character.isUpperCase(c)) {
upperCnt++; upperCount++;
} }
if (Character.isLowerCase(c)) { if (Character.isLowerCase(c)) {
lowerCnt++; lowerCount++;
} }
} }
LetterCount result = new LetterCount(upperCnt, lowerCnt); LetterCount result = new LetterCount(upperCount, lowerCount);
assertEquals(4, result.getUppercaseCount()); assertEquals(4, result.getUppercaseCount());
assertEquals(31, result.getLowercaseCount()); assertEquals(31, result.getLowercaseCount());
} }