TetrisAdvancedGame extends TetrisGame implements TetrisJoystik, Cloneable { @Override public void left(int delta) { moveHorizontallyIfAccepted(x - delta < currentFigure.getLeft() ? currentFigure.getLeft() : x - delta); } TetrisAdvancedGame(FigureQueue queue, Glass glass, PrinterFactory printerFactory); @Override void left(int delta); @Override void right(int delta);  }
@Test @GivenFiguresInQueue({@FigureProperties}) public void shouldBeMovedLeftWhenAsked() { game.left(2); game.tick(); assertCoordinates(CENTER_X - 2, TOP_Y - 1); }
@Test @GivenFiguresInQueue({@FigureProperties}) public void shouldBeMovedLeftNegativeWhenAsked() { game.left(-2); game.tick(); assertCoordinates(CENTER_X + 2, TOP_Y - 1); }
@Test @GivenFiguresInQueue({@FigureProperties}) public void shouldChangePositionWhenOnlyNextStep(){ game.left(2); assertCoordinates(CENTER_X, TOP_Y); }
@Test @GivenFiguresInQueue({@FigureProperties}) public void shouldNotMoveOutWhenLeftSide(){ game.left(CENTER_X + 1); game.tick(); assertCoordinates(0, TOP_Y - 1); }
@Test @GivenFiguresInQueue({@FigureProperties}) public void shouldNotMoveOutNegativeWhenLeftSide(){ game.left(-(CENTER_X + 1)); game.tick(); assertCoordinates(WIDTH - 1, TOP_Y - 1); }
@Test @GivenFiguresInQueue({@FigureProperties(left = 1)}) public void shouldIncludeFigureSizeWhenMoveLeft() { game.left(CENTER_X + 1); game.tick(); assertCoordinates(1, HEIGHT - 1); }
@Test @GivenFiguresInQueue({@FigureProperties}) public void shouldMoveLeftWhenAcceptOnly(){ rejectWhenCoordinates(CENTER_X - 1, HEIGHT); acceptWhenCoordinates(CENTER_X, HEIGHT - 1); game.left(1); game.tick(); assertCoordinates(CENTER_X, HEIGHT - 1); }