Files
Java/src/test/java/com/thealgorithms/strings/RemoveDuplicateFromStringTest.java
Deniz Altunkapan 6c24d27b03 Move methods from others to correct packages (#6475)
refactor: Move methods from `others` package to their respective packages
2025-08-18 22:28:19 +02:00

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"));
}
}