@Test
  public void testIndexCreationExceptionOnRegionWithNewDTD() throws Exception {
    if (cache != null && !cache.isClosed()) {
      cache.close();
    }

    cacheXmlFile = temporaryFolder.newFile("cachequeryindexwitherror.xml");
    FileUtils.copyURLToFile(getClass().getResource("cachequeryindexwitherror.xml"),
        cacheXmlFile);
    assertThat(cacheXmlFile).exists(); // precondition

    Properties props = new Properties();
    props.setProperty(CACHE_XML_FILE, cacheXmlFile.getAbsolutePath());
    props.setProperty(MCAST_PORT, "0");

    DistributedSystem ds = DistributedSystem.connect(props);

    // TODO: refactoring GemFireCacheImpl.initializeDeclarativeCache requires change here
    assertThatThrownBy(() -> CacheFactory.create(ds)).isExactlyInstanceOf(CacheXmlException.class)
        .hasCauseInstanceOf(InternalGemFireException.class);
  }
TODO: move this to a different test class because it requires different setup
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/NewDeclarativeIndexCreationJUnitTest.java