@Test public void addListener() { TileableListener listener = mock(TileableListener.class); Tileable tileable = new HorizontalTrack(); tileable.addListener(listener); assertThat(tileable.getListeners()).containsExactly(listener); }
public boolean addListener(TileableListener listener) { return listeners.add(listener); }
Tileable implements Entity { public boolean addListener(TileableListener listener) { return listeners.add(listener); } }
Tileable implements Entity { public boolean addListener(TileableListener listener) { return listeners.add(listener); }  }
Tileable implements Entity { public boolean addListener(TileableListener listener) { return listeners.add(listener); }  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 { public boolean addListener(TileableListener listener) { return listeners.add(listener); }  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();  }