TetrisAdvancedGame extends TetrisGame implements TetrisJoystik, Cloneable { @Override public void right(int delta) { moveHorizontallyIfAccepted(x + delta > 9 - currentFigure.getRight() ? 9 - currentFigure.getRight() : x + delta); } TetrisAdvancedGame(FigureQueue queue, Glass glass, PrinterFactory printerFactory); @Override void left(int delta); @Override void right(int delta);  }
@Test @GivenFiguresInQueue({@FigureProperties}) public void shouldBeMovedRightWhenAsked() { game.right(2); game.tick(); assertCoordinates(CENTER_X + 2, TOP_Y - 1); }
@Test @GivenFiguresInQueue({@FigureProperties}) public void shouldNotMoveOutWhenRightSide(){ game.right(CENTER_X + 2); game.tick(); assertCoordinates(9, TOP_Y - 1); }
@Test @GivenFiguresInQueue({@FigureProperties(right = 1)}) public void shouldIncludeFigureSizeWhenMoveRight() { game.right(CENTER_X + 1); game.tick(); assertCoordinates(9 - 1, HEIGHT - 1); }
@Test @GivenFiguresInQueue({@FigureProperties}) public void shouldMoveRightWhenAcceptOnly() { rejectWhenCoordinates(CENTER_X + 1, HEIGHT); acceptWhenCoordinates(CENTER_X, HEIGHT - 1); game.right(1); game.tick(); assertCoordinates(CENTER_X, HEIGHT - 1); }