class MongoDbDecorator implements TestMethodDecorator {

    @Override
    public void afterTest(final TestInvocation invocation) throws Exception {
        final ExecutionContext context = invocation.getContext();

        final MongoDatabase mongoDb = (MongoDatabase) context.getData(Constants.KEY_MONGO_DB);
        final MongoDbFeatureExecutor dbFeatureExecutor = (MongoDbFeatureExecutor) context.getData(Constants.KEY_FEATURE_EXECUTOR);
        context.storeData(Constants.KEY_MONGO_DB, null);
        context.storeData(Constants.KEY_FEATURE_EXECUTOR, null);

        dbFeatureExecutor.executeAfterTest(mongoDb, invocation.getException().isPresent());
    }

}