[count-upper-lower] add unicode char tests

This commit is contained in:
Kai.Yuan 2024-02-03 00:28:22 +01:00
parent 746c6f5083
commit a7a97689ba
1 changed files with 8 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package com.baeldung.countupperandlowercasechars;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class CountUpperAndLowercaseCharsUnitTest { public class CountUpperAndLowercaseCharsUnitTest {
private static final String MY_STRING = "Hi, Welcome to Baeldung! Let's count letters!"; private static final String MY_STRING = "Hi, Welcome to Baeldung! Let's count letters!";
@ -50,6 +51,13 @@ public class CountUpperAndLowercaseCharsUnitTest {
assertEquals(4, result.getUppercaseCount()); assertEquals(4, result.getUppercaseCount());
assertEquals(31, result.getLowercaseCount()); assertEquals(31, result.getLowercaseCount());
} }
@Test
void whenUsingIsUpperCaseAndIsLowerCase_thenUnicodeCharactersCanBeChecked() {
assertTrue(Character.isLowerCase('ä'));
assertTrue(Character.isUpperCase('Ä'));
}
} }
class LetterCount { class LetterCount {