### Question:
DataMigrationManagerImpl implements DataMigrationManager { @Override public boolean pluginExists(final String name) { return migrationPlugins.containsKey(name); } @Inject  DataMigrationManagerImpl( final Set<MigrationPlugin> plugins,
                                     final MigrationInfoSerialization migrationInfoSerialization,
                                     final MigrationInfoCache migrationInfoCache
    ); @Override boolean pluginExists(final String name); @Override void migrate(final String name); @Override void migrate(); @Override boolean isRunning(); @Override int getCurrentVersion( final String pluginName ); @Override void resetToVersion( final String pluginName, final int version ); @Override String getLastStatus( final String pluginName ); @Override Set<String> getPluginNames(); List<MigrationPlugin> getExecutionOrder();  }### Answer:
@Test public void testPluginExists() throws MigrationException { final Set<MigrationPlugin> plugins = new HashSet<>(); MigrationPlugin plugin1 = mock( MigrationPlugin.class ); when( plugin1.getPhase() ).thenReturn( PluginPhase.MIGRATE ); when( plugin1.getName() ).thenReturn( "plugin1" ); MigrationPlugin plugin2 = mock( MigrationPlugin.class ); when( plugin2.getPhase() ).thenReturn( PluginPhase.MIGRATE ); when( plugin2.getName() ).thenReturn( "plugin2" ); plugins.add( plugin1 ); plugins.add( plugin2 ); final MigrationInfoSerialization migrationInfoSerialization = mock( MigrationInfoSerialization.class ); final MigrationInfoCache migrationInfoCache = mock(MigrationInfoCache.class); DataMigrationManagerImpl migrationManager = new DataMigrationManagerImpl( plugins, migrationInfoSerialization,migrationInfoCache ); Set<String> pluginNames = migrationManager.getPluginNames(); assertEquals(2, pluginNames.size()); assertTrue(pluginNames.contains("plugin1")); assertTrue(pluginNames.contains("plugin2")); assertTrue( migrationManager.pluginExists("plugin1") ); assertTrue( migrationManager.pluginExists("plugin2") ); assertFalse( migrationManager.pluginExists("plugin3") ); }