@Test public void acceptTopException() { TileableListener listener = mock(TileableListener.class); Marble marble = new Marble(MarbleType.BLUE); Direction direction = Direction.TOP; track.addListener(listener); assertThatThrownBy(() -> track.accept(direction, marble)) .isInstanceOf(IllegalArgumentException.class); verify(listener, never()).ballAccepted(track, direction, marble); }
@Override public void accept(Direction direction, Marble marble) { switch (direction) { case LEFT: case RIGHT: informAcceptation(direction, marble); break; default: throw new IllegalArgumentException("The track does not accept balls from the given " + "direction"); } }
HorizontalTrack extends Track { @Override public void accept(Direction direction, Marble marble) { switch (direction) { case LEFT: case RIGHT: informAcceptation(direction, marble); break; default: throw new IllegalArgumentException("The track does not accept balls from the given " + "direction"); } } }
HorizontalTrack extends Track { @Override public void accept(Direction direction, Marble marble) { switch (direction) { case LEFT: case RIGHT: informAcceptation(direction, marble); break; default: throw new IllegalArgumentException("The track does not accept balls from the given " + "direction"); } }  }
HorizontalTrack extends Track { @Override public void accept(Direction direction, Marble marble) { switch (direction) { case LEFT: case RIGHT: informAcceptation(direction, marble); break; default: throw new IllegalArgumentException("The track does not accept balls from the given " + "direction"); } }  boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction direction); @Override boolean accepts(Direction direction, Marble marble); @Override void accept(Direction direction, Marble marble); }
HorizontalTrack extends Track { @Override public void accept(Direction direction, Marble marble) { switch (direction) { case LEFT: case RIGHT: informAcceptation(direction, marble); break; default: throw new IllegalArgumentException("The track does not accept balls from the given " + "direction"); } }  boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction direction); @Override boolean accepts(Direction direction, Marble marble); @Override void accept(Direction direction, Marble marble);  }