@Test
public void testCreateWhenBundleVersionAlreadyExists() throws IOException {

    final BundleVersionType type = BundleVersionType.NIFI_NAR;
    final String content1 = "g1-a1-1.0.0";
    final BundleVersionCoordinate versionCoordinate = getVersionCoordinate("b1", "g1", "a1", "1.0.0", type);
    createBundleVersion(fileSystemBundleProvider, versionCoordinate, content1);
    verifyBundleVersion(bundleStorageDir, versionCoordinate, content1);
    // try to save same bundle version that already exists
    try {
        final String newContent = "new content";
        createBundleVersion(fileSystemBundleProvider, versionCoordinate, newContent);
        Assert.fail("Should have thrown exception");
    } catch (BundlePersistenceException e) {
        // expected
    }
    // verify existing content wasn't modified
    verifyBundleVersion(bundleStorageDir, versionCoordinate, content1);
}