-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✅ test: add function string4j test #5
- Loading branch information
1 parent
b114974
commit 2a9ba01
Showing
1 changed file
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package org.unify4j; | ||
|
||
import org.junit.Test; | ||
import org.unify4j.common.String4j; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNull; | ||
|
||
public class String4jTest { | ||
|
||
@Test | ||
public void testStripAccents_NullInput() { | ||
assertNull(String4j.stripAccents(null)); | ||
} | ||
|
||
@Test | ||
public void testStripAccents_EmptyString() { | ||
assertEquals("", String4j.stripAccents("")); | ||
} | ||
|
||
@Test | ||
public void testStripAccents_NoAccents() { | ||
assertEquals("abcdefg", String4j.stripAccents("abcdefg")); | ||
} | ||
|
||
@Test | ||
public void testStripAccents_WithAccents() { | ||
assertEquals("aeiou", String4j.stripAccents("áéíóú")); | ||
assertEquals("aeiou", String4j.stripAccents("àèìòù")); | ||
assertEquals("aeiou", String4j.stripAccents("âêîôû")); | ||
assertEquals("aeiou", String4j.stripAccents("äëïöü")); | ||
} | ||
|
||
@Test | ||
public void testStripAccents_MixedCharacters() { | ||
assertEquals("Cafe", String4j.stripAccents("Café")); | ||
assertEquals("Jose", String4j.stripAccents("José")); | ||
assertEquals("Garcon", String4j.stripAccents("Garçon")); | ||
} | ||
|
||
@Test | ||
public void testStripAccents_ComplexCharacters() { | ||
assertEquals("Donna", String4j.stripAccents("Dõñna")); | ||
assertEquals("Cu Chulainn", String4j.stripAccents("Cú Chulainn")); | ||
} | ||
|
||
@Test | ||
public void testUnAccents_EmptyString() { | ||
assertEquals("", String4j.unAccents("")); | ||
} | ||
|
||
@Test | ||
public void testUnAccents_NoNonASCII() { | ||
assertEquals("abcdefg", String4j.unAccents("abcdefg")); | ||
} | ||
|
||
@Test | ||
public void testUnAccents_WithAccents() { | ||
assertEquals("aeiou", String4j.unAccents("áéíóú")); | ||
assertEquals("aeiou", String4j.unAccents("àèìòù")); | ||
assertEquals("aeiou", String4j.unAccents("âêîôû")); | ||
assertEquals("aeiou", String4j.unAccents("äëïöü")); | ||
} | ||
|
||
@Test | ||
public void testUnAccents_MixedCharacters() { | ||
assertEquals("Cafe", String4j.unAccents("Café")); | ||
assertEquals("Jose", String4j.unAccents("José")); | ||
assertEquals("Garcon", String4j.unAccents("Garçon")); | ||
} | ||
|
||
@Test | ||
public void testUnAccents_ComplexCharacters() { | ||
assertEquals("Donna", String4j.unAccents("Dõñna")); | ||
assertEquals("Cu Chulainn", String4j.unAccents("Cú Chulainn")); | ||
} | ||
|
||
@Test | ||
public void testUnAccents_WithNonASCII() { | ||
assertEquals("abc123", String4j.unAccents("ábç123")); | ||
assertEquals("Hello World", String4j.unAccents("Hëllö Wörld")); | ||
assertEquals("ASCIIOnly", String4j.unAccents("ASCIIÖnly")); | ||
} | ||
|
||
@Test | ||
public void testUnAccents_OnlyNonASCII() { | ||
assertEquals("aeioun", String4j.unAccents("áéíóúñ")); | ||
assertEquals("oau", String4j.unAccents("öäüß")); | ||
assertEquals("cccsz", String4j.unAccents("çćčšž")); | ||
} | ||
} |