MongoMetadataEngine extends CommonsMetadataEngine<MongoClient> { @Override protected void dropCatalog(CatalogName name, Connection<MongoClient> connection) throws ExecutionException { try { connection.getNativeConnection().dropDatabase(name.getName()); } catch (MongoException e) { logger.error("Error dropping the catalog: " + e.getMessage()); throw new ExecutionException(e.getMessage(), e); } } private  MongoMetadataEngine(MongoConnectionHandler connectionHandler); static MongoMetadataEngine getInstance(MongoConnectionHandler connectionHandler);  }
@Test public void dropCatalogTest() throws ExecutionException, UnsupportedException { mongoMetadataEngine.dropCatalog(new CatalogName(DB_NAME), connection); verify(client, times(1)).dropDatabase(Matchers.anyString()); }
@Test public void dropCatalogExecutionExceptionTest() throws ExecutionException, UnsupportedException { Mockito.doThrow(new MongoException("exception")).when(client).dropDatabase(Matchers.anyString()); try { mongoMetadataEngine.dropCatalog(new CatalogName(DB_NAME), connection); fail("An execution exception must be thown"); } catch (ExecutionException e) { } verify(client, times(1)).dropDatabase(Matchers.anyString()); }