TextElement implements IRenderingElement { @Override public void accept(IRenderingVisitor visotor) { visotor.visit(this); } TextElement(double xCoord, double yCoord, String text, Color color); @Override void accept(IRenderingVisitor visotor); final double xCoord; final double yCoord; final String text; final Color color; }
@Test public void testAccept() { TextElement elem = new TextElement(0, 0, "Foo", Color.ORANGE); MockVisitor visitor = new MockVisitor(); Assert.assertFalse(visitor.isVisited); elem.accept(visitor); Assert.assertTrue(visitor.isVisited); }