mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-12-19 07:00:35 +08:00
45 lines
1.1 KiB
Java
45 lines
1.1 KiB
Java
package com.thealgorithms.strings;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
class RemoveDuplicateFromStringTest {
|
|
|
|
@Test
|
|
void testEmptyString() {
|
|
assertEquals("", RemoveDuplicateFromString.removeDuplicate(""));
|
|
}
|
|
|
|
@Test
|
|
void testNullString() {
|
|
assertNull(RemoveDuplicateFromString.removeDuplicate(null));
|
|
}
|
|
|
|
@Test
|
|
void testSingleCharacterString() {
|
|
assertEquals("a", RemoveDuplicateFromString.removeDuplicate("a"));
|
|
}
|
|
|
|
@Test
|
|
void testStringWithNoDuplicates() {
|
|
assertEquals("abc", RemoveDuplicateFromString.removeDuplicate("abc"));
|
|
}
|
|
|
|
@Test
|
|
void testStringWithDuplicates() {
|
|
assertEquals("abcd", RemoveDuplicateFromString.removeDuplicate("aabbbccccddddd"));
|
|
}
|
|
|
|
@Test
|
|
void testStringWithAllSameCharacters() {
|
|
assertEquals("a", RemoveDuplicateFromString.removeDuplicate("aaaaa"));
|
|
}
|
|
|
|
@Test
|
|
void testStringWithMixedCase() {
|
|
assertEquals("abAB", RemoveDuplicateFromString.removeDuplicate("aabABAB"));
|
|
}
|
|
}
|