Skip to content

Commit f35aeb5

Browse files
authored
Add ReverseStringTest (#3607)
Co-authored-by: jtuong <Rofleveryday1?>
1 parent 8d4b048 commit f35aeb5

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.thealgorithms.strings;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import static org.junit.jupiter.api.Assertions.assertEquals;
6+
7+
public class ReverseStringTest {
8+
9+
@Test
10+
public void ReverseStringTest() {
11+
String input1 = "Hello World";
12+
String input2 = "helloworld";
13+
String input3 = "123456789";
14+
String input4 = "";
15+
16+
String expectedOutput1 = "dlroW olleH";
17+
String expectedOutput2 = "dlrowolleh";
18+
String expectedOutput3 = "987654321";
19+
String expectedOutput4 = "";
20+
21+
assertEquals(ReverseString.reverse(input1), expectedOutput1);
22+
assertEquals(ReverseString.reverse(input2), expectedOutput2);
23+
assertEquals(ReverseString.reverse(input3), expectedOutput3);
24+
assertEquals(ReverseString.reverse(input4), expectedOutput4);
25+
26+
assertEquals(ReverseString.reverse2(input1), expectedOutput1);
27+
assertEquals(ReverseString.reverse2(input2), expectedOutput2);
28+
assertEquals(ReverseString.reverse2(input3), expectedOutput3);
29+
assertEquals(ReverseString.reverse2(input4), expectedOutput4);
30+
}
31+
}

0 commit comments

Comments
 (0)