@@ -13,12 +13,55 @@ void fullJustify() {
13
13
String [] input =
14
14
new String [] {"This" , "is" , "an" , "example" , "of" , "text" , "justification." };
15
15
List <String > actual = new Solution ().fullJustify (input , 16 );
16
-
17
16
List <String > expected = new ArrayList <>();
18
17
expected .add ("This is an" );
19
18
expected .add ("example of text" );
20
19
expected .add ("justification. " );
20
+ assertThat (actual , equalTo (expected ));
21
+ }
22
+
23
+ @ Test
24
+ void fullJustify2 () {
25
+ String [] input = new String [] {"What" , "must" , "be" , "acknowledgment" , "shall" , "be" };
26
+ List <String > actual = new Solution ().fullJustify (input , 16 );
27
+ List <String > expected = new ArrayList <>();
28
+ expected .add ("What must be" );
29
+ expected .add ("acknowledgment " );
30
+ expected .add ("shall be " );
31
+ assertThat (actual , equalTo (expected ));
32
+ }
21
33
34
+ @ Test
35
+ void fullJustify3 () {
36
+ String [] input =
37
+ new String [] {
38
+ "Science" ,
39
+ "is" ,
40
+ "what" ,
41
+ "we" ,
42
+ "understand" ,
43
+ "well" ,
44
+ "enough" ,
45
+ "to" ,
46
+ "explain" ,
47
+ "to" ,
48
+ "a" ,
49
+ "computer." ,
50
+ "Art" ,
51
+ "is" ,
52
+ "everything" ,
53
+ "else" ,
54
+ "we" ,
55
+ "do"
56
+ };
57
+ List <String > actual = new Solution ().fullJustify (input , 20 );
58
+ List <String > expected = new ArrayList <>();
59
+ expected .add ("Science is what we" );
60
+ expected .add ("understand well" );
61
+ expected .add ("enough to explain to" );
62
+ expected .add ("a computer. Art is" );
63
+ expected .add ("everything else we" );
64
+ expected .add ("do " );
22
65
assertThat (actual , equalTo (expected ));
23
66
}
24
67
}
0 commit comments