File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
src/test/java/com/thealgorithms/strings Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments