@Override
  public BuiltIndex<NewRegularIndex> build() {
    checkState(mainType != null, "Mapping for main type must be defined");
    checkState(!mainType.getIndex().acceptsRelations() || !getRelations().isEmpty(), "At least one relation must be defined when index accepts relations");
    return new BuiltIndex<>(this);
  }
@Test
  @UseDataProvider("indexWithAndWithoutRelations")
  public void build_fails_with_ISE_if_no_mainType_is_defined(Index index) {
    NewRegularIndex underTest = new NewRegularIndex(index, defaultSettingsConfiguration);

    assertThatThrownBy(() -> underTest.build())
      .isInstanceOf(IllegalStateException.class)
      .hasMessage("Mapping for main type must be defined");
  }