use of dev.morphia.mapping.codec.pojo.EntityModel in project morphia by mongodb.
the class TestMapping method collectionNaming.
@Test
public void collectionNaming() {
MapperOptions options = MapperOptions.builder().collectionNaming(NamingStrategy.lowerCase()).build();
Datastore datastore = createDatastore(TestBase.TEST_DB_NAME, options);
List<EntityModel> map = datastore.getMapper().map(ContainsMapWithEmbeddedInterface.class, ContainsIntegerList.class);
assertEquals(map.get(0).getCollectionName(), "containsmapwithembeddedinterface");
assertEquals(map.get(1).getCollectionName(), "cil");
options = MapperOptions.builder().collectionNaming(NamingStrategy.kebabCase()).build();
datastore = createDatastore(TestBase.TEST_DB_NAME, options);
map = datastore.getMapper().map(ContainsMapWithEmbeddedInterface.class, ContainsIntegerList.class);
assertEquals(map.get(0).getCollectionName(), "contains-map-with-embedded-interface");
assertEquals(map.get(1).getCollectionName(), "cil");
}
use of dev.morphia.mapping.codec.pojo.EntityModel in project morphia by mongodb.
the class TestVersioning method testCanMapAPackageContainingAVersionedAbstractBaseClass.
@Test
public void testCanMapAPackageContainingAVersionedAbstractBaseClass() {
getMapper().mapPackage("dev.morphia.test.models.versioned");
List<EntityModel> entities = getMapper().getMappedEntities();
assertThat(entities.size(), is(3));
List<Class<?>> list = new ArrayList<>();
for (EntityModel entityModel : entities) {
list.add(entityModel.getType());
}
assertTrue(list.contains(VersionedChildEntity.class));
assertTrue(list.contains(AbstractVersionedBase.class));
}
Aggregations