1
+ import org .junit .jupiter .api .BeforeAll ;
2
+ import org .junit .jupiter .api .Test ;
3
+
4
+ import static org .junit .jupiter .api .Assertions .*;
5
+
6
+ class RemoveExtraSpacesTest {
7
+
8
+ String stringTest1 = "Test with no extra space" ;
9
+ String stringTest2 = "Test with extra space" ;
10
+ String stringTest3 = " Test with extra space at the beginning" ;
11
+ String stringTest4 = "Test with extra space at the end " ;
12
+
13
+ @ Test
14
+ public void RemoveSpaceWithNoExtraSpace () {
15
+ String expectedResult = "Test with no extra space" ;
16
+ String actualResult = Main .removeExtraSpaces (stringTest1 );
17
+ assertEquals (expectedResult , actualResult );
18
+ }
19
+
20
+ @ Test
21
+ public void RemoveSpaceWithExtraSpace () {
22
+ String expectedResult = "Test with extra space" ;
23
+ String actualResult = Main .removeExtraSpaces (stringTest2 );
24
+ assertEquals (expectedResult , actualResult );
25
+ }
26
+
27
+ @ Test
28
+ public void RemoveSpaceWithSpaceAtBeginning () {
29
+ String expectedResult = "Test with extra space at the beginning" ;
30
+ String actualResult = Main .removeExtraSpaces (stringTest3 );
31
+ assertEquals (expectedResult , actualResult );
32
+ }
33
+
34
+ @ Test
35
+ public void RemoveSpaceWithSpaceAtEnd () {
36
+ String expectedResult = "Test with extra space at the end" ;
37
+ String actualResult = Main .removeExtraSpaces (stringTest4 );
38
+ assertEquals (expectedResult , actualResult );
39
+ }
40
+ }
0 commit comments