use of org.mongodb.morphia.mapping.MappedClass in project morphia by mongodb.
the class QueryValidatorTest method shouldNotAllowStringValueWithTypeThatIsNotString.
@Test
public void shouldNotAllowStringValueWithTypeThatIsNotString() {
// expect
MappedClass mappedClass = new MappedClass(SimpleEntity.class, new Mapper());
MappedField mappedField = mappedClass.getMappedField("name");
assertThat(QueryValidator.isCompatibleForOperator(mappedClass, mappedField, Integer.class, EQUAL, "value", new ArrayList<ValidationFailure>()), is(false));
}
use of org.mongodb.morphia.mapping.MappedClass in project morphia by mongodb.
the class TestEmbeddedArrayIndexes method testParamEntity.
@Test
public void testParamEntity() throws Exception {
final MappedClass mc = getMorphia().getMapper().getMappedClass(A.class);
assertNotNull(mc);
assertEquals(1, mc.getAnnotations(Indexes.class).size());
getDs().ensureIndexes(A.class);
final DBCollection coll = getDs().getCollection(A.class);
assertEquals("indexes found: coll.getIndexInfo()" + coll.getIndexInfo(), 3, coll.getIndexInfo().size());
}
Aggregations