@Test public void informAcceptation() { TileableListener listener = mock(TileableListener.class); Tileable tileable = new HorizontalTrack(); Direction direction = Direction.RIGHT; Marble marble = new Marble(MarbleType.BLUE); tileable.addListener(listener); tileable.informAcceptation(direction, marble); verify(listener, times(1)).ballAccepted(tileable, direction, marble); }
protected void informAcceptation(Direction direction, Marble marble) { for (TileableListener listener : listeners) { listener.ballAccepted(this, direction, marble); } }
Tileable implements Entity { protected void informAcceptation(Direction direction, Marble marble) { for (TileableListener listener : listeners) { listener.ballAccepted(this, direction, marble); } } }
Tileable implements Entity { protected void informAcceptation(Direction direction, Marble marble) { for (TileableListener listener : listeners) { listener.ballAccepted(this, direction, marble); } }  }
Tileable implements Entity { protected void informAcceptation(Direction direction, Marble marble) { for (TileableListener listener : listeners) { listener.ballAccepted(this, direction, marble); } }  abstract boolean allowsConnection(Direction direction); abstract boolean accepts(Direction direction, Marble marble); abstract void accept(Direction direction, Marble marble); boolean isConnected(Direction direction); boolean isReleasable(Direction direction, Marble marble); void release(Direction direction, Marble marble); Tile getTile(); void setTile(Tile tile); Set<TileableListener> getListeners(); boolean addListener(TileableListener listener); boolean removeListener(TileableListener listener); boolean onGrid(); }
Tileable implements Entity { protected void informAcceptation(Direction direction, Marble marble) { for (TileableListener listener : listeners) { listener.ballAccepted(this, direction, marble); } }  abstract boolean allowsConnection(Direction direction); abstract boolean accepts(Direction direction, Marble marble); abstract void accept(Direction direction, Marble marble); boolean isConnected(Direction direction); boolean isReleasable(Direction direction, Marble marble); void release(Direction direction, Marble marble); Tile getTile(); void setTile(Tile tile); Set<TileableListener> getListeners(); boolean addListener(TileableListener listener); boolean removeListener(TileableListener listener); boolean onGrid();  }