@Test
  public void testCanonicalIds() {
    // Create an init file and add some canonical ids.
    DiskInitFile dif =
        new DiskInitFile("testFile", mockedDiskStoreImpl, false, Collections.emptySet());
    assertThat(dif.getCanonicalObject(5)).isNull();
    assertThat(dif.getCanonicalObject(0)).isNull();
    int id1 = dif.getOrCreateCanonicalId("object1");
    int id2 = dif.getOrCreateCanonicalId("object2");
    assertThat(dif.getCanonicalObject(id1)).isEqualTo("object1");
    assertThat(dif.getCanonicalObject(id2)).isEqualTo("object2");
    assertThat(dif.getOrCreateCanonicalId("object2")).isEqualTo(id2);
    dif.createRegion(mockDiskRegionView);

    // Close the init file and recover the init file from disk
    dif.close();
    dif = new DiskInitFile("testFile", mockedDiskStoreImpl, true, Collections.emptySet());

    // Make sure we can recover the ids from disk
    assertThat(dif.getCanonicalObject(id1)).isEqualTo("object1");
    assertThat(dif.getCanonicalObject(id2)).isEqualTo("object2");
    assertThat(dif.getOrCreateCanonicalId("object2")).isEqualTo(id2);

    // Make sure we can add new ids
    int id3 = dif.getOrCreateCanonicalId("object3");
    assertThat(id3).isGreaterThan(id2);
    assertThat(dif.getCanonicalObject(id1)).isEqualTo("object1");
    assertThat(dif.getCanonicalObject(id2)).isEqualTo("object2");
    assertThat(dif.getCanonicalObject(id3)).isEqualTo("object3");

    dif.close();
  }
Test the behavior of canonical ids in the init file.
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskInitFileJUnitTest.java