BAEL-4301
- Updated assertTrue to assertEqual - Added examples
This commit is contained in:
parent
7bb2282d24
commit
1cc511ae5e
|
@ -3,35 +3,36 @@ package com.baeldung.character;
|
|||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class CharacterGeneralCategoryTypeUnitTest {
|
||||
@Test
|
||||
public void givenACharacter_whenUpperCaseLetter_thenAssertTrue() {
|
||||
assertTrue(Character.getType('U') == Character.UPPERCASE_LETTER);
|
||||
assertEquals(Character.UPPERCASE_LETTER, Character.getType('U'));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenACharacter_whenLowerCaseLetter_thenAssertTrue() {
|
||||
assertTrue(Character.getType('u') == Character.LOWERCASE_LETTER);
|
||||
assertEquals(Character.LOWERCASE_LETTER, Character.getType('u'));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenACharacter_whenTitleCaseLetter_thenAssertTrue() {
|
||||
assertTrue(Character.getType('\u01f2') == Character.TITLECASE_LETTER);
|
||||
assertEquals(Character.TITLECASE_LETTER, Character.getType('\u01f2'));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenACharacter_whenModifierLetter_thenAssertTrue() {
|
||||
assertTrue(Character.getType('\u02b0') == Character.MODIFIER_LETTER);
|
||||
assertEquals(Character.MODIFIER_LETTER, Character.getType('\u02b0'));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenACharacter_whenOtherLetter_thenAssertTrue() {
|
||||
assertTrue(Character.getType('\u05d0') == Character.OTHER_LETTER);
|
||||
assertEquals(Character.OTHER_LETTER, Character.getType('\u05d0'));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenACharacter_whenLetterNumber_thenAssertTrue() {
|
||||
assertTrue(Character.getType('\u2164') == Character.LETTER_NUMBER);
|
||||
assertEquals(Character.LETTER_NUMBER, Character.getType('\u2164'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,27 @@ import static org.junit.Assert.assertTrue;
|
|||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
public class IsLetterOrAlphabetUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenACharacter_whenUpperCaseLetter_thenAssertIsAlphabeticTrue() {
|
||||
assertTrue(Character.isAlphabetic('A'));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenACharacter_whenTitleCaseLetter_thenAssertIsAlphabeticTrue() {
|
||||
assertTrue(Character.isAlphabetic('\u01f2'));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenACharacter_whenLowerCaseLetter_thenAssertIsLetterTrue() {
|
||||
assertTrue(Character.isAlphabetic('a'));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenACharacter_whenModifierLetter_thenAssertIsLetterTrue() {
|
||||
assertTrue(Character.isAlphabetic('\u02b0'));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenACharacter_whenLetter_thenAssertIsLetterTrue() {
|
||||
assertTrue(Character.isLetter('a'));
|
||||
|
|
Loading…
Reference in New Issue