@Test
  public void testExternalVersionConflict() throws Exception {

    assertFalse(VersionType.EXTERNAL.isVersionConflict(Versions.NOT_FOUND, 10));
    assertFalse(VersionType.EXTERNAL.isVersionConflict(Versions.NOT_SET, 10));
    // MATCH_ANY must throw an exception in the case of external version, as the version must be
    // set! it used as the new value
    assertTrue(VersionType.EXTERNAL.isVersionConflict(10, Versions.MATCH_ANY));

    // if we didn't find a version (but the index does support it), we always accept
    assertFalse(VersionType.EXTERNAL.isVersionConflict(Versions.NOT_FOUND, Versions.NOT_FOUND));
    assertFalse(VersionType.EXTERNAL.isVersionConflict(Versions.NOT_FOUND, 10));
    assertFalse(VersionType.EXTERNAL.isVersionConflict(Versions.NOT_FOUND, Versions.MATCH_ANY));

    // and the standard behavior
    assertTrue(VersionType.EXTERNAL.isVersionConflict(10, 10));
    assertFalse(VersionType.EXTERNAL.isVersionConflict(9, 10));
    assertTrue(VersionType.EXTERNAL.isVersionConflict(10, 9));

    // Old indexing code, dictating behavior
    //        // an external version is provided, just check, if a local version exists, that its
    // higher than it
    //        // the actual version checking is one in an external system, and we just want to not
    // index older versions
    //        if (currentVersion >= 0) { // we can check!, its there
    //            if (currentVersion >= index.version()) {
    //                throw new VersionConflictEngineException(shardId, index.type(), index.id(),
    // currentVersion, index.version());
    //            }
    //        }
    //        updatedVersion = index.version();
  }
  @Test
  public void testUpdateVersion() {

    assertThat(VersionType.INTERNAL.updateVersion(Versions.NOT_SET, 10), equalTo(1l));
    assertThat(VersionType.INTERNAL.updateVersion(Versions.NOT_FOUND, 10), equalTo(1l));
    assertThat(VersionType.INTERNAL.updateVersion(1, 1), equalTo(2l));
    assertThat(VersionType.INTERNAL.updateVersion(2, Versions.MATCH_ANY), equalTo(3l));

    assertThat(VersionType.EXTERNAL.updateVersion(Versions.NOT_SET, 10), equalTo(10l));
    assertThat(VersionType.EXTERNAL.updateVersion(Versions.NOT_FOUND, 10), equalTo(10l));
    assertThat(VersionType.EXTERNAL.updateVersion(1, 10), equalTo(10l));

    // Old indexing code
    //        if (index.versionType() == VersionType.INTERNAL) { // internal version type
    //            updatedVersion = (currentVersion == Versions.NOT_SET || currentVersion ==
    // Versions.NOT_FOUND) ? 1 : currentVersion + 1;
    //        } else { // external version type
    //            updatedVersion = expectedVersion;
    //        }
  }