### Question:
Cake { public void addLayer(CakeLayer layer) { this.layers.add(layer); } Cake(); Long getId(); void setId(Long id); CakeTopping getTopping(); void setTopping(CakeTopping topping); Set<CakeLayer> getLayers(); void setLayers(Set<CakeLayer> layers); void addLayer(CakeLayer layer); @Override String toString();  }### Answer:
@Test public void testAddLayer() { final var cake = new Cake(); assertNotNull(cake.getLayers()); assertTrue(cake.getLayers().isEmpty()); final Set<CakeLayer> initialLayers = new HashSet<>(); initialLayers.add(new CakeLayer("layer1", 1000)); initialLayers.add(new CakeLayer("layer2", 2000)); cake.setLayers(initialLayers); assertEquals(initialLayers, cake.getLayers()); final var newLayer = new CakeLayer("layer3", 3000); cake.addLayer(newLayer); final Set<CakeLayer> expectedLayers = new HashSet<>(); expectedLayers.addAll(initialLayers); expectedLayers.addAll(initialLayers); expectedLayers.add(newLayer); assertEquals(expectedLayers, cake.getLayers()); }