@Test
  @GivenFiguresInQueue({@FigureProperties})
  public void shouldBeMovedRightWhenAsked() {
    game.right();
    game.tick();

    assertCoordinates(CENTER_X + 1, TOP_Y - 1);
  }
  @Test
  @GivenFiguresInQueue({@FigureProperties(bottom = 1), @FigureProperties(bottom = 2)})
  public void shouldTakeNextFigureWhenCurrentIsDropped() {
    game.down();
    game.tick();

    assertCoordinates(CENTER_X, HEIGHT);
    assertEquals(2, figureCaptor.getValue().getBottom());
  }
  @Test
  public void shouldRotateOnce() {
    TetrisGame game = createGameWithOneFigureInQueue(letterIFigure);
    glassToAcceptFigure();
    game.tick();

    game.act(1);

    captureFigureAtValues();
    Figure capturedFigure = figureCaptor.getValue();
    assertThat(capturedFigure.getRowCodes(false)).isEqualTo(new int[] {0b001001001001});
  }
  @Test
  @GivenFiguresInQueue({@FigureProperties})
  public void shouldChangePositionWhenOnlyNextStep() {
    game.left();

    assertCoordinates(CENTER_X, TOP_Y);
  }
  @Test
  @GivenFiguresInQueue({@FigureProperties(right = 1)})
  public void shouldIncludeFigureSizeWhenMoveRight() {
    right(CENTER_X + 1);
    game.tick();

    assertCoordinates(9 - 1, HEIGHT - 1);
  }
  @Test
  @GivenFiguresInQueue({@FigureProperties})
  public void shouldNotMoveOutWhenRightSide() {
    right(CENTER_X + 2);
    game.tick();

    assertCoordinates(9, TOP_Y - 1);
  }
  @Test
  @GivenFiguresInQueue({@FigureProperties})
  public void shouldNotChangeCurrentFigureWhenNextStep() {
    game.tick();

    captureFigureAtValues();
    List<Figure> allFigures = figureCaptor.getAllValues();
    assertSame(allFigures.get(0), allFigures.get(1));
  }
  @Test
  @GivenFiguresInQueue({@FigureProperties(bottom = HEIGHT), @FigureProperties(bottom = 1)})
  public void shouldGameOverWhenGlassOverflown() {
    glassToRejectFigure();
    game.tick();

    assertCoordinates(CENTER_X, HEIGHT);
    assertGameOver();
  }
  @Test
  @GivenFiguresInQueue({@FigureProperties, @FigureProperties(left = 1)})
  public void shouldPerformDropWhenRejected() {
    acceptWhenCoordinates(CENTER_X, HEIGHT);
    rejectWhenCoordinates(CENTER_X, HEIGHT - 1);

    game.tick();

    verifyDroppedAt(CENTER_X, HEIGHT);
  }
  @Test
  @GivenFiguresInQueue({@FigureProperties, @FigureProperties(left = 1)})
  public void shouldOverflowWhenFigureRejectedAtFirstStep() {
    rejectWhenCoordinates(CENTER_X, HEIGHT);

    game.tick();

    assertCoordinates(CENTER_X, HEIGHT);
    assertGameOver();
  }
  @Test
  @GivenFiguresInQueue({@FigureProperties})
  public void shouldMoveRightWhenAcceptOnly() {
    rejectWhenCoordinates(CENTER_X + 1, HEIGHT);
    acceptWhenCoordinates(CENTER_X, HEIGHT - 1);

    right(1);
    game.tick();

    assertCoordinates(CENTER_X, HEIGHT - 1);
  }
  @Test
  @GivenFiguresInQueue({@FigureProperties, @FigureProperties(left = 1)})
  public void shouldTakeNextFigureWhenRejectedAfterNextStep() {
    acceptWhenCoordinates(CENTER_X, HEIGHT);
    rejectWhenCoordinates(CENTER_X, HEIGHT - 1);

    game.tick();

    captureFigureAtValues();
    assertThat(yCaptor.getAllValues()).isEqualTo(Arrays.asList(HEIGHT, HEIGHT));
    assertEquals(1, figureCaptor.getValue().getLeft());
  }
 private void right(int times) {
   for (int i = 0; i < times; i++) {
     game.right();
   }
 }
 private void left(int times) {
   for (int i = 0; i < times; i++) {
     game.left();
   }
 }