Cake { public void setTopping(CakeTopping topping) { this.topping = topping; } Cake(); Long getId(); void setId(Long id); CakeTopping getTopping(); void setTopping(CakeTopping topping); Set<CakeLayer> getLayers(); final void setLayers(Set<CakeLayer> layers); void addLayer(CakeLayer layer); @Override String toString();  }
@Test public void testSetTopping() { final Cake cake = new Cake(); assertNull(cake.getTopping()); final CakeTopping expectedTopping = new CakeTopping("DummyTopping", 1000); cake.setTopping(expectedTopping); assertEquals(expectedTopping, cake.getTopping()); }