@Test public void isNotConnected() { Grid grid = new Grid(null, 1, 1); grid.place(0, 0, track); assertThat(track.isConnected()).isFalse(); }
public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.TOP); Tile right = tile.get(Direction.BOTTOM); return left != null && right != null; }
VerticalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.TOP); Tile right = tile.get(Direction.BOTTOM); return left != null && right != null; } }
VerticalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.TOP); Tile right = tile.get(Direction.BOTTOM); return left != null && right != null; }  }
VerticalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.TOP); Tile right = tile.get(Direction.BOTTOM); return left != null && right != null; }  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); }
VerticalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.TOP); Tile right = tile.get(Direction.BOTTOM); return left != null && right != null; }  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);  }