diff --git a/exercises/practice/flower-field/.meta/tests.toml b/exercises/practice/flower-field/.meta/tests.toml index c2b24fdaf..965ba8fd4 100644 --- a/exercises/practice/flower-field/.meta/tests.toml +++ b/exercises/practice/flower-field/.meta/tests.toml @@ -44,3 +44,6 @@ description = "cross" [dd9d4ca8-9e68-4f78-a677-a2a70fd7a7b8] description = "large garden" + +[6e4ac13a-3e43-4728-a2e3-3551d4b1a996] +description = "multiple adjacent flowers" diff --git a/exercises/practice/flower-field/src/test/java/FlowerFieldBoardTest.java b/exercises/practice/flower-field/src/test/java/FlowerFieldBoardTest.java index 3eba013f6..58f995293 100644 --- a/exercises/practice/flower-field/src/test/java/FlowerFieldBoardTest.java +++ b/exercises/practice/flower-field/src/test/java/FlowerFieldBoardTest.java @@ -2,7 +2,6 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -24,8 +23,8 @@ public void testInputBoardWithNoRowsAndNoColumns() { @Test @DisplayName("no columns") public void testInputBoardWithOneRowAndNoColumns() { - List inputBoard = Collections.singletonList(""); - List expectedNumberedBoard = Collections.singletonList(""); + List inputBoard = List.of(""); + List expectedNumberedBoard = List.of(""); List actualNumberedBoard = new FlowerFieldBoard(inputBoard).withNumbers(); assertThat(actualNumberedBoard).isEqualTo(expectedNumberedBoard); @@ -35,13 +34,13 @@ public void testInputBoardWithOneRowAndNoColumns() { @Test @DisplayName("no flowers") public void testInputBoardWithNoFlowers() { - List inputBoard = Arrays.asList( + List inputBoard = List.of( " ", " ", " " ); - List expectedNumberedBoard = Arrays.asList( + List expectedNumberedBoard = List.of( " ", " ", " " @@ -56,13 +55,13 @@ public void testInputBoardWithNoFlowers() { @Test @DisplayName("garden full of flowers") public void testInputBoardWithOnlyFlowers() { - List inputBoard = Arrays.asList( + List inputBoard = List.of( "***", "***", "***" ); - List expectedNumberedBoard = Arrays.asList( + List expectedNumberedBoard = List.of( "***", "***", "***" @@ -77,13 +76,13 @@ public void testInputBoardWithOnlyFlowers() { @Test @DisplayName("flower surrounded by spaces") public void testInputBoardWithSingleFlowerAtCenter() { - List inputBoard = Arrays.asList( + List inputBoard = List.of( " ", " * ", " " ); - List expectedNumberedBoard = Arrays.asList( + List expectedNumberedBoard = List.of( "111", "1*1", "111" @@ -98,13 +97,13 @@ public void testInputBoardWithSingleFlowerAtCenter() { @Test @DisplayName("space surrounded by flowers") public void testInputBoardWithFlowersAroundPerimeter() { - List inputBoard = Arrays.asList( + List inputBoard = List.of( "***", "* *", "***" ); - List expectedNumberedBoard = Arrays.asList( + List expectedNumberedBoard = List.of( "***", "*8*", "***" @@ -119,11 +118,11 @@ public void testInputBoardWithFlowersAroundPerimeter() { @Test @DisplayName("horizontal line") public void testInputBoardWithSingleRowAndTwoFlowers() { - List inputBoard = Collections.singletonList( + List inputBoard = List.of( " * * " ); - List expectedNumberedBoard = Collections.singletonList( + List expectedNumberedBoard = List.of( "1*2*1" ); @@ -136,11 +135,11 @@ public void testInputBoardWithSingleRowAndTwoFlowers() { @Test @DisplayName("horizontal line, flowers at edges") public void testInputBoardWithSingleRowAndTwoFlowersAtEdges() { - List inputBoard = Collections.singletonList( + List inputBoard = List.of( "* *" ); - List expectedNumberedBoard = Collections.singletonList( + List expectedNumberedBoard = List.of( "*1 1*" ); @@ -153,7 +152,7 @@ public void testInputBoardWithSingleRowAndTwoFlowersAtEdges() { @Test @DisplayName("vertical line") public void testInputBoardWithSingleColumnAndTwoFlowers() { - List inputBoard = Arrays.asList( + List inputBoard = List.of( " ", "*", " ", @@ -161,7 +160,7 @@ public void testInputBoardWithSingleColumnAndTwoFlowers() { " " ); - List expectedNumberedBoard = Arrays.asList( + List expectedNumberedBoard = List.of( "1", "*", "2", @@ -178,7 +177,7 @@ public void testInputBoardWithSingleColumnAndTwoFlowers() { @Test @DisplayName("vertical line, flowers at edges") public void testInputBoardWithSingleColumnAndTwoFlowersAtEdges() { - List inputBoard = Arrays.asList( + List inputBoard = List.of( "*", " ", " ", @@ -186,7 +185,7 @@ public void testInputBoardWithSingleColumnAndTwoFlowersAtEdges() { "*" ); - List expectedNumberedBoard = Arrays.asList( + List expectedNumberedBoard = List.of( "*", "1", " ", @@ -203,7 +202,7 @@ public void testInputBoardWithSingleColumnAndTwoFlowersAtEdges() { @Test @DisplayName("cross") public void testInputBoardWithFlowersInCross() { - List inputBoard = Arrays.asList( + List inputBoard = List.of( " * ", " * ", "*****", @@ -211,7 +210,7 @@ public void testInputBoardWithFlowersInCross() { " * " ); - List expectedNumberedBoard = Arrays.asList( + List expectedNumberedBoard = List.of( " 2*2 ", "25*52", "*****", @@ -228,7 +227,7 @@ public void testInputBoardWithFlowersInCross() { @Test @DisplayName("large garden") public void testLargeInputBoard() { - List inputBoard = Arrays.asList( + List inputBoard = List.of( " * * ", " * ", " * ", @@ -237,7 +236,7 @@ public void testLargeInputBoard() { " " ); - List expectedNumberedBoard = Arrays.asList( + List expectedNumberedBoard = List.of( "1*22*1", "12*322", " 123*2", @@ -251,4 +250,20 @@ public void testLargeInputBoard() { assertThat(actualNumberedBoard).isEqualTo(expectedNumberedBoard); } + @Disabled("Remove to run test") + @Test + @DisplayName("multiple adjacent flowers") + public void testMultipleAdjacentFlowers() { + List inputBoard = List.of( + " ** " + ); + + List expectedNumberedBoard = List.of( + "1**1" + ); + + List actualNumberedBoard = new FlowerFieldBoard(inputBoard).withNumbers(); + + assertThat(actualNumberedBoard).isEqualTo(expectedNumberedBoard); + } }