Search in sources :

Example 1 with Builder

use of dev.morphia.mapping.MapperOptions.Builder in project morphia by mongodb.

the class TestMapperOptions method lowercaseDefaultCollection.

@Test
public void lowercaseDefaultCollection() {
    DummyEntity entity = new DummyEntity();
    String collectionName = getMapper().getEntityModel(entity.getClass()).getCollectionName();
    assertEquals(collectionName, "dummyEntity", "uppercase");
    Builder builder = MapperOptions.builder(getMapper().getOptions());
    final Datastore datastore = Morphia.createDatastore(getMongoClient(), getDatabase().getName(), builder.collectionNaming(NamingStrategy.lowerCase()).build());
    collectionName = datastore.getMapper().getEntityModel(entity.getClass()).getCollectionName();
    assertEquals(collectionName, "dummyentity", "lowercase");
}
Also used : Datastore(dev.morphia.Datastore) Builder(dev.morphia.mapping.MapperOptions.Builder) Test(org.testng.annotations.Test)

Aggregations

Datastore (dev.morphia.Datastore)1 Builder (dev.morphia.mapping.MapperOptions.Builder)1 Test (org.testng.annotations.Test)1