use of org.mongodb.morphia.mapping.MappedClass in project morphia by mongodb.
the class QueryValidatorTest method shouldNotAllowNonBooleanValuesForExistsOperator.
@Test
public void shouldNotAllowNonBooleanValuesForExistsOperator() {
// given
MappedClass mappedClass = new MappedClass(SimpleEntity.class, new Mapper());
MappedField mappedField = mappedClass.getMappedField("name");
assertThat(QueryValidator.isCompatibleForOperator(mappedClass, mappedField, SimpleEntity.class, EXISTS, "value", new ArrayList<ValidationFailure>()), is(false));
}
use of org.mongodb.morphia.mapping.MappedClass in project morphia by mongodb.
the class QueryValidatorTest method shouldNotAllowNonKeyTypeWithKeyValue.
@Test
public void shouldNotAllowNonKeyTypeWithKeyValue() {
// expect
MappedClass mappedClass = new MappedClass(EntityWithListsAndArrays.class, new Mapper());
MappedField mappedField = mappedClass.getMappedField("listOfIntegers");
assertThat(QueryValidator.isCompatibleForOperator(mappedClass, mappedField, SimpleEntity.class, EQUAL, new Key<String>(String.class, "kind", new ObjectId()), new ArrayList<ValidationFailure>()), is(false));
}
use of org.mongodb.morphia.mapping.MappedClass in project morphia by mongodb.
the class QueryValidatorTest method shouldAllowTypeThatMatchesKeyTypeValue.
@Test
public void shouldAllowTypeThatMatchesKeyTypeValue() {
// expect
MappedClass mappedClass = new MappedClass(SimpleEntity.class, new Mapper());
MappedField mappedField = mappedClass.getMappedField("integer");
assertThat(QueryValidator.isCompatibleForOperator(mappedClass, mappedField, Integer.class, EQUAL, new Key<Number>(Integer.class, "Integer", new ObjectId()), new ArrayList<ValidationFailure>()), is(true));
}
use of org.mongodb.morphia.mapping.MappedClass in project morphia by mongodb.
the class QueryValidatorTest method shouldNotAllowOtherValuesForNotInOperator.
@Test
public void shouldNotAllowOtherValuesForNotInOperator() {
// expect
MappedClass mappedClass = new MappedClass(SimpleEntity.class, new Mapper());
MappedField mappedField = mappedClass.getMappedField("name");
assertThat(QueryValidator.isCompatibleForOperator(mappedClass, mappedField, SimpleEntity.class, NOT_IN, "value", new ArrayList<ValidationFailure>()), is(false));
}
use of org.mongodb.morphia.mapping.MappedClass in project morphia by mongodb.
the class QueryValidatorTest method shouldNotAllowGeoOperatorIfValueIsNotDBObject.
@Test
public void shouldNotAllowGeoOperatorIfValueIsNotDBObject() {
// expect
MappedClass mappedClass = new MappedClass(GeoEntity.class, new Mapper());
MappedField mappedField = mappedClass.getMappedField("array");
assertThat(QueryValidator.isCompatibleForOperator(mappedClass, mappedField, List.class, GEO_WITHIN, "value", new ArrayList<ValidationFailure>()), is(false));
}
Aggregations