Search in sources :

Example 1 with SimpleEntity

use of org.mongodb.morphia.entities.SimpleEntity in project morphia by mongodb.

the class EntityAnnotatedValueValidatorTest method shouldAllowValueWithEntityAnnotationAndTypeOfKey.

@Test
public void shouldAllowValueWithEntityAnnotationAndTypeOfKey() {
    // given
    ArrayList<ValidationFailure> validationFailures = new ArrayList<ValidationFailure>();
    // when
    boolean validationApplied = EntityAnnotatedValueValidator.getInstance().apply(Key.class, new SimpleEntity(), validationFailures);
    // then
    assertThat(validationApplied, is(true));
    assertThat(validationFailures.size(), is(0));
}
Also used : SimpleEntity(org.mongodb.morphia.entities.SimpleEntity) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 2 with SimpleEntity

use of org.mongodb.morphia.entities.SimpleEntity in project morphia by mongodb.

the class EntityAnnotatedValueValidatorTest method shouldNotValidateValueWithEntityAnnotationAndNonKeyType.

@Test
public void shouldNotValidateValueWithEntityAnnotationAndNonKeyType() {
    // given
    ArrayList<ValidationFailure> validationFailures = new ArrayList<ValidationFailure>();
    // when
    boolean validationApplied = EntityAnnotatedValueValidator.getInstance().apply(String.class, new SimpleEntity(), validationFailures);
    // then
    assertThat(validationApplied, is(false));
    assertThat(validationFailures.size(), is(0));
}
Also used : SimpleEntity(org.mongodb.morphia.entities.SimpleEntity) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 3 with SimpleEntity

use of org.mongodb.morphia.entities.SimpleEntity in project morphia by mongodb.

the class KeyValueTypeValidatorTest method shouldNotValidateWhenValueIsNotAKey.

@Test
public void shouldNotValidateWhenValueIsNotAKey() {
    // given
    ArrayList<ValidationFailure> validationFailures = new ArrayList<ValidationFailure>();
    // when
    boolean validationApplied = KeyValueTypeValidator.getInstance().apply(String.class, new SimpleEntity(), validationFailures);
    // then
    assertThat(validationApplied, is(false));
    assertThat(validationFailures.size(), is(0));
}
Also used : SimpleEntity(org.mongodb.morphia.entities.SimpleEntity) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 SimpleEntity (org.mongodb.morphia.entities.SimpleEntity)3