BlobExportMechanismModule extends AbstractModule { @VisibleForTesting @Provides @Singleton BlobExportMechanism provideMechanism(BlobExportImplChoice implChoice, Provider<LocalFileBlobExportMechanism> localFileMechanismProvider, Provider<LinshareBlobExportMechanism> linshareMechanismProvider) { switch (implChoice) { case LOCAL_FILE: return localFileMechanismProvider.get(); case LINSHARE: return linshareMechanismProvider.get(); default: throw new RuntimeException("blobExportMechanism '" + implChoice.getImplName() + "' is not supported yet"); } }    }
@Test void provideMechanismShouldProvideFileExportWhenPassingLocalFileChoice() { assertThat(module.provideMechanism(BlobExportImplChoice.LOCAL_FILE, LOCAL_FILE_EXPORT_PROVIDER, LINSHARE_FILE_EXPORT_PROVIDER)) .isEqualTo(LOCAL_FILE_EXPORT); }
@Test void provideMechanismShouldProvideLinshareExportWhenPassingLinshareChoice() { assertThat(module.provideMechanism(BlobExportImplChoice.LINSHARE, LOCAL_FILE_EXPORT_PROVIDER, LINSHARE_FILE_EXPORT_PROVIDER)) .isEqualTo(LINSHARE_EXPORT); }