@Override
  public TypeMapping createTypeMapping(IndexMainType mainType) {
    checkState(this.mainType == null, "Main type can only be defined once");
    this.mainType = mainType;
    return super.createTypeMapping(mainType);
  }
@Test
  @UseDataProvider("indexWithAndWithoutRelations")
  public void createTypeMapping_with_IndexMainType_fails_with_ISE_if_called_twice(Index index) {
    NewRegularIndex underTest = new NewRegularIndex(index, defaultSettingsConfiguration);
    underTest.createTypeMapping(IndexType.main(index, "foo"));

    assertThatThrownBy(() -> underTest.createTypeMapping(IndexType.main(index, "foo")))
      .isInstanceOf(IllegalStateException.class)
      .hasMessage("Main type can only be defined once");
  }