@Override
  public void register(Component component) {
    checkComponent(component);
    checkArgument(component.getType() == Component.Type.FILE, "component must be a file");
    checkState(analysisMetadataHolder.isPullRequest() || !analysisMetadataHolder.isFirstAnalysis(), "No file can be registered on first branch analysis");

    addedComponents.add(component);
  }
@Test
  public void register_fails_with_ISE_if_called_on_first_analysis() {
    when(analysisMetadataHolder.isFirstAnalysis()).thenReturn(true);
    Component component = newComponent(Component.Type.FILE);

    assertThatThrownBy(() -> underTest.register(component))
      .isInstanceOf(IllegalStateException.class)
      .hasMessage("No file can be registered on first branch analysis");
  }