### Question:
Teleporter extends Tileable implements TileableListener { public void setDestination(Teleporter destination) { if (!track.getClass().equals(destination.getTrack().getClass())) { throw new IllegalStateException("Both connected teleporters must be either" + " horizontal or vertical"); } this.destination = destination; } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean allowsConnection(Direction direction); @Override boolean accepts(Direction direction, Marble marble); @Override void accept(Direction direction, Marble marble); @Override void ballAccepted(Tileable tileable, Direction direction, Marble marble); @Override void ballDisposed(Tileable tileable, Direction direction, Marble marble); @Override void ballReleased(Tileable tileable, Direction direction, Marble marble);  }### Answer:
@Test public void setDestinationFail() { Teleporter vertTeleporter = new Teleporter(new VerticalTrack()); assertThatThrownBy(() -> vertTeleporter.setDestination(teleporter1)) .isInstanceOf(IllegalStateException.class); assertThatThrownBy(() -> teleporter1.setDestination(vertTeleporter)) .isInstanceOf(IllegalStateException.class); }