22import org .junit .jupiter .api .DisplayName ;
33import org .junit .jupiter .api .Test ;
44
5- import java .util .Arrays ;
65import java .util .Collections ;
76import java .util .List ;
87
@@ -24,8 +23,8 @@ public void testInputBoardWithNoRowsAndNoColumns() {
2423 @ Test
2524 @ DisplayName ("no columns" )
2625 public void testInputBoardWithOneRowAndNoColumns () {
27- List <String > inputBoard = Collections . singletonList ("" );
28- List <String > expectedNumberedBoard = Collections . singletonList ("" );
26+ List <String > inputBoard = List . of ("" );
27+ List <String > expectedNumberedBoard = List . of ("" );
2928 List <String > actualNumberedBoard = new FlowerFieldBoard (inputBoard ).withNumbers ();
3029
3130 assertThat (actualNumberedBoard ).isEqualTo (expectedNumberedBoard );
@@ -35,13 +34,13 @@ public void testInputBoardWithOneRowAndNoColumns() {
3534 @ Test
3635 @ DisplayName ("no flowers" )
3736 public void testInputBoardWithNoFlowers () {
38- List <String > inputBoard = Arrays . asList (
37+ List <String > inputBoard = List . of (
3938 " " ,
4039 " " ,
4140 " "
4241 );
4342
44- List <String > expectedNumberedBoard = Arrays . asList (
43+ List <String > expectedNumberedBoard = List . of (
4544 " " ,
4645 " " ,
4746 " "
@@ -56,13 +55,13 @@ public void testInputBoardWithNoFlowers() {
5655 @ Test
5756 @ DisplayName ("garden full of flowers" )
5857 public void testInputBoardWithOnlyFlowers () {
59- List <String > inputBoard = Arrays . asList (
58+ List <String > inputBoard = List . of (
6059 "***" ,
6160 "***" ,
6261 "***"
6362 );
6463
65- List <String > expectedNumberedBoard = Arrays . asList (
64+ List <String > expectedNumberedBoard = List . of (
6665 "***" ,
6766 "***" ,
6867 "***"
@@ -77,13 +76,13 @@ public void testInputBoardWithOnlyFlowers() {
7776 @ Test
7877 @ DisplayName ("flower surrounded by spaces" )
7978 public void testInputBoardWithSingleFlowerAtCenter () {
80- List <String > inputBoard = Arrays . asList (
79+ List <String > inputBoard = List . of (
8180 " " ,
8281 " * " ,
8382 " "
8483 );
8584
86- List <String > expectedNumberedBoard = Arrays . asList (
85+ List <String > expectedNumberedBoard = List . of (
8786 "111" ,
8887 "1*1" ,
8988 "111"
@@ -98,13 +97,13 @@ public void testInputBoardWithSingleFlowerAtCenter() {
9897 @ Test
9998 @ DisplayName ("space surrounded by flowers" )
10099 public void testInputBoardWithFlowersAroundPerimeter () {
101- List <String > inputBoard = Arrays . asList (
100+ List <String > inputBoard = List . of (
102101 "***" ,
103102 "* *" ,
104103 "***"
105104 );
106105
107- List <String > expectedNumberedBoard = Arrays . asList (
106+ List <String > expectedNumberedBoard = List . of (
108107 "***" ,
109108 "*8*" ,
110109 "***"
@@ -119,11 +118,11 @@ public void testInputBoardWithFlowersAroundPerimeter() {
119118 @ Test
120119 @ DisplayName ("horizontal line" )
121120 public void testInputBoardWithSingleRowAndTwoFlowers () {
122- List <String > inputBoard = Collections . singletonList (
121+ List <String > inputBoard = List . of (
123122 " * * "
124123 );
125124
126- List <String > expectedNumberedBoard = Collections . singletonList (
125+ List <String > expectedNumberedBoard = List . of (
127126 "1*2*1"
128127 );
129128
@@ -136,11 +135,11 @@ public void testInputBoardWithSingleRowAndTwoFlowers() {
136135 @ Test
137136 @ DisplayName ("horizontal line, flowers at edges" )
138137 public void testInputBoardWithSingleRowAndTwoFlowersAtEdges () {
139- List <String > inputBoard = Collections . singletonList (
138+ List <String > inputBoard = List . of (
140139 "* *"
141140 );
142141
143- List <String > expectedNumberedBoard = Collections . singletonList (
142+ List <String > expectedNumberedBoard = List . of (
144143 "*1 1*"
145144 );
146145
@@ -153,15 +152,15 @@ public void testInputBoardWithSingleRowAndTwoFlowersAtEdges() {
153152 @ Test
154153 @ DisplayName ("vertical line" )
155154 public void testInputBoardWithSingleColumnAndTwoFlowers () {
156- List <String > inputBoard = Arrays . asList (
155+ List <String > inputBoard = List . of (
157156 " " ,
158157 "*" ,
159158 " " ,
160159 "*" ,
161160 " "
162161 );
163162
164- List <String > expectedNumberedBoard = Arrays . asList (
163+ List <String > expectedNumberedBoard = List . of (
165164 "1" ,
166165 "*" ,
167166 "2" ,
@@ -178,15 +177,15 @@ public void testInputBoardWithSingleColumnAndTwoFlowers() {
178177 @ Test
179178 @ DisplayName ("vertical line, flowers at edges" )
180179 public void testInputBoardWithSingleColumnAndTwoFlowersAtEdges () {
181- List <String > inputBoard = Arrays . asList (
180+ List <String > inputBoard = List . of (
182181 "*" ,
183182 " " ,
184183 " " ,
185184 " " ,
186185 "*"
187186 );
188187
189- List <String > expectedNumberedBoard = Arrays . asList (
188+ List <String > expectedNumberedBoard = List . of (
190189 "*" ,
191190 "1" ,
192191 " " ,
@@ -203,15 +202,15 @@ public void testInputBoardWithSingleColumnAndTwoFlowersAtEdges() {
203202 @ Test
204203 @ DisplayName ("cross" )
205204 public void testInputBoardWithFlowersInCross () {
206- List <String > inputBoard = Arrays . asList (
205+ List <String > inputBoard = List . of (
207206 " * " ,
208207 " * " ,
209208 "*****" ,
210209 " * " ,
211210 " * "
212211 );
213212
214- List <String > expectedNumberedBoard = Arrays . asList (
213+ List <String > expectedNumberedBoard = List . of (
215214 " 2*2 " ,
216215 "25*52" ,
217216 "*****" ,
@@ -228,7 +227,7 @@ public void testInputBoardWithFlowersInCross() {
228227 @ Test
229228 @ DisplayName ("large garden" )
230229 public void testLargeInputBoard () {
231- List <String > inputBoard = Arrays . asList (
230+ List <String > inputBoard = List . of (
232231 " * * " ,
233232 " * " ,
234233 " * " ,
@@ -237,7 +236,7 @@ public void testLargeInputBoard() {
237236 " "
238237 );
239238
240- List <String > expectedNumberedBoard = Arrays . asList (
239+ List <String > expectedNumberedBoard = List . of (
241240 "1*22*1" ,
242241 "12*322" ,
243242 " 123*2" ,
@@ -251,4 +250,20 @@ public void testLargeInputBoard() {
251250 assertThat (actualNumberedBoard ).isEqualTo (expectedNumberedBoard );
252251 }
253252
253+ @ Disabled ("Remove to run test" )
254+ @ Test
255+ @ DisplayName ("multiple adjacent flowers" )
256+ public void testMultipleAdjacentFlowers () {
257+ List <String > inputBoard = List .of (
258+ " ** "
259+ );
260+
261+ List <String > expectedNumberedBoard = List .of (
262+ "1**1"
263+ );
264+
265+ List <String > actualNumberedBoard = new FlowerFieldBoard (inputBoard ).withNumbers ();
266+
267+ assertThat (actualNumberedBoard ).isEqualTo (expectedNumberedBoard );
268+ }
254269}
0 commit comments