### Question:
FileSystemBundlePersistenceProvider implements BundlePersistenceProvider { @Override public synchronized void createBundleVersion(final BundlePersistenceContext context, final InputStream contentStream) throws BundlePersistenceException { saveOrUpdateBundleVersion(context, contentStream, false); }  @Override void onConfigured(final ProviderConfigurationContext configurationContext); @Override synchronized void createBundleVersion(final BundlePersistenceContext context, final InputStream contentStream); @Override synchronized void updateBundleVersion(final BundlePersistenceContext context, final InputStream contentStream); @Override synchronized void getBundleVersionContent(final BundleVersionCoordinate versionCoordinate, final OutputStream outputStream); @Override synchronized void deleteBundleVersion(final BundleVersionCoordinate versionCoordinate); @Override synchronized void deleteAllBundleVersions(final BundleCoordinate bundleCoordinate);  }### Answer:
@Test public void testCreateSuccessfully() throws IOException { final BundleVersionType type = BundleVersionType.NIFI_NAR; final String content1 = "g1-a1-1.0.0"; final BundleVersionCoordinate versionCoordinate1 = getVersionCoordinate("b1", "g1", "a1", "1.0.0", type); createBundleVersion(fileSystemBundleProvider, versionCoordinate1 , content1); verifyBundleVersion(bundleStorageDir, versionCoordinate1, content1); final String content2 = "g1-a1-1.1.0"; final BundleVersionCoordinate versionCoordinate2 = getVersionCoordinate("b1", "g1", "a1", "1.1.0", type); createBundleVersion(fileSystemBundleProvider, versionCoordinate2, content2); verifyBundleVersion(bundleStorageDir, versionCoordinate2, content2); final String content3 = "g1-a1-1.1.0"; final BundleVersionCoordinate versionCoordinate3 = getVersionCoordinate("b2", "g1", "a1", "1.1.0", type); createBundleVersion(fileSystemBundleProvider, versionCoordinate3, content3); verifyBundleVersion(bundleStorageDir, versionCoordinate3, content2); }
@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 { final String newContent = "new content"; createBundleVersion(fileSystemBundleProvider, versionCoordinate, newContent); Assert.fail("Should have thrown exception"); } catch (BundlePersistenceException e) { } verifyBundleVersion(bundleStorageDir, versionCoordinate, content1); }