@VisibleForTesting
    static DBCollection prepareCollection(final MongoConnection mongoConnection) {
        final DB db = mongoConnection.getDatabase();

        DBCollection coll = db.getCollection(COLLECTION_NAME);

        coll.createIndex(DBSort
                .asc("timestamp")
                .asc("producer")
                .asc("consumers"));

        coll.setWriteConcern(WriteConcern.JOURNALED);

        return coll;
    }
@Test
    public void prepareCollectionCreatesCollectionIfItDoesNotExist() throws Exception {
        @SuppressWarnings("deprecation")
        final DB database = mongoConnection.getDatabase();
        database.getCollection(ClusterEventPeriodical.COLLECTION_NAME).drop();
        assertThat(database.collectionExists(ClusterEventPeriodical.COLLECTION_NAME)).isFalse();
        DBCollection collection = ClusterEventPeriodical.prepareCollection(mongoConnection);

        assertThat(collection.getName()).isEqualTo(ClusterEventPeriodical.COLLECTION_NAME);
        assertThat(collection.getIndexInfo()).hasSize(2);
        assertThat(collection.getWriteConcern()).isEqualTo(WriteConcern.JOURNALED);
    }