forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemovingStarsFromStringTest.java
More file actions
57 lines (45 loc) · 1.37 KB
/
RemovingStarsFromStringTest.java
File metadata and controls
57 lines (45 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.thealgorithms.strings;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
class RemovingStarsFromStringTest {
@Test
void testEmptyString() {
assertEquals("", RemovingStarsFromString.removeStars(""));
}
@Test
void testNullString() {
assertEquals(null, RemovingStarsFromString.removeStars(null));
}
@Test
void testStringWithNoStars() {
assertEquals("leetcode", RemovingStarsFromString.removeStars("leetcode"));
}
@Test
void testBasicExample() {
assertEquals("lecoe", RemovingStarsFromString.removeStars("leet**cod*e"));
}
@Test
void testAllStars() {
assertEquals("", RemovingStarsFromString.removeStars("abc***"));
}
@Test
void testSingleCharacterWithStar() {
assertEquals("", RemovingStarsFromString.removeStars("a*"));
}
@Test
void testMultipleConsecutiveStars() {
assertEquals("ac", RemovingStarsFromString.removeStars("abc**d*"));
}
@Test
void testStarAtEnd() {
assertEquals("leet", RemovingStarsFromString.removeStars("leetc*"));
}
@Test
void testComplexPattern() {
assertEquals("", RemovingStarsFromString.removeStars("a*b*c*"));
}
@Test
void testNoRemoval() {
assertEquals("hello", RemovingStarsFromString.removeStars("hello"));
}
}