/** * Use forEach, with the given StringBuilder, to assemble a String which represents every Shape in * the given list. * * <p>Change the 'method under test' to make the test pass. * * <p>The String should be a concatenation of each Shape's toString. * * @see Shapes#makeStringOfAllColors(java.util.List, StringBuilder) * @see Shape#toString() * @see StringBuilder#append(String) * @see Iterable#forEach */ @Test public void buildStringRepresentingAllShapes() { List<Shape> allMyShapes = Arrays.asList(new Shape(RED), new Shape(BLACK), new Shape(YELLOW)); StringBuilder builder = new StringBuilder(); // method under test Shapes.makeStringOfAllColors(allMyShapes, builder); assertThat(builder.toString(), equalTo("[a RED shape][a BLACK shape][a YELLOW shape]")); }