use of dev.morphia.internal.PathTarget in project morphia by mongodb.
the class PathTargetTest method propertyNameResolution.
@Test
public void propertyNameResolution() {
getMapper().map(City.class, EmbeddedType.class);
Mapper mapper = getMapper();
EntityModel entityModel = mapper.getEntityModel(City.class);
PathTarget pathTarget = new PathTarget(mapper, entityModel, "name");
Assert.assertEquals(pathTarget.translatedPath(), "city");
Assert.assertEquals(entityModel.getProperty("name"), pathTarget.getTarget());
pathTarget = new PathTarget(mapper, entityModel, "city");
Assert.assertEquals(pathTarget.translatedPath(), "city");
Assert.assertEquals(entityModel.getProperty("city"), pathTarget.getTarget());
}
use of dev.morphia.internal.PathTarget in project morphia by mongodb.
the class PathTargetTest method disableValidation.
@Test
public void disableValidation() {
getMapper().map(FatherEntity.class);
Mapper mapper = getMapper();
final PathTarget pathTarget = new PathTarget(mapper, FatherEntity.class, "nested.field.fail", false);
Assert.assertEquals(pathTarget.translatedPath(), "nested.field.fail");
Assert.assertNull(pathTarget.getTarget());
}
use of dev.morphia.internal.PathTarget in project morphia by mongodb.
the class TestUpdateOperations method testPlaceholderOperators.
@Test
public void testPlaceholderOperators() {
new PathTarget(getMapper(), DumbColl.class, "fromArray.$").translatedPath();
new PathTarget(getMapper(), DumbColl.class, "fromArray.$[]").translatedPath();
new PathTarget(getMapper(), DumbColl.class, "fromArray.$[element]").translatedPath();
}
Aggregations