### Question:
CakeViewImpl implements View { public void render() { cakeBakingService.getAllCakes().forEach(cake -> LOGGER.info(cake.toString())); } CakeViewImpl(CakeBakingService cakeBakingService); void render();  }### Answer:
@Test public void testRender() { final List<CakeLayerInfo> layers = new ArrayList<>(); layers.add(new CakeLayerInfo("layer1", 1000)); layers.add(new CakeLayerInfo("layer2", 2000)); layers.add(new CakeLayerInfo("layer3", 3000)); final List<CakeInfo> cakes = new ArrayList<>(); final CakeInfo cake = new CakeInfo(new CakeToppingInfo("topping", 1000), layers); cakes.add(cake); final CakeBakingService bakingService = mock(CakeBakingService.class); when(bakingService.getAllCakes()).thenReturn(cakes); final CakeViewImpl cakeView = new CakeViewImpl(bakingService); assertEquals(0, appender.getLogSize()); cakeView.render(); assertEquals(cake.toString(), appender.getLastMessage()); }
@Test public void testRender() { final var layers = List.of( new CakeLayerInfo("layer1", 1000), new CakeLayerInfo("layer2", 2000), new CakeLayerInfo("layer3", 3000)); final var cake = new CakeInfo(new CakeToppingInfo("topping", 1000), layers); final var cakes = List.of(cake); final var bakingService = mock(CakeBakingService.class); when(bakingService.getAllCakes()).thenReturn(cakes); final var cakeView = new CakeViewImpl(bakingService); assertEquals(0, appender.getLogSize()); cakeView.render(); assertEquals(cake.toString(), appender.getLastMessage()); }