Search in sources :

Example 6 with ScaleValidator

use of com.qcadoo.model.internal.validators.ScaleValidator in project qcadoo by qcadoo.

the class ValidatorTest method shouldIgnoreScaleValidatorForStringValue.

@Test
public void shouldIgnoreScaleValidatorForStringValue() throws Exception {
    // given
    Entity entity = new DefaultEntity(dataDefinition);
    entity.setField("name", "Qcadoo Framework RLZ!");
    fieldDefinitionName.withValidator(new ScaleValidator(null, 1, null));
    // when
    entity = dataDefinition.save(entity);
    // then
    verify(session).save(any(SampleSimpleDatabaseObject.class));
    assertTrue(entity.isValid());
}
Also used : Entity(com.qcadoo.model.api.Entity) DefaultEntity(com.qcadoo.model.internal.DefaultEntity) DefaultEntity(com.qcadoo.model.internal.DefaultEntity) ScaleValidator(com.qcadoo.model.internal.validators.ScaleValidator) SampleSimpleDatabaseObject(com.qcadoo.model.beans.sample.SampleSimpleDatabaseObject) DataAccessTest(com.qcadoo.model.internal.DataAccessTest) Test(org.junit.Test)

Aggregations

ScaleValidator (com.qcadoo.model.internal.validators.ScaleValidator)6 Entity (com.qcadoo.model.api.Entity)5 SampleSimpleDatabaseObject (com.qcadoo.model.beans.sample.SampleSimpleDatabaseObject)5 DataAccessTest (com.qcadoo.model.internal.DataAccessTest)5 DefaultEntity (com.qcadoo.model.internal.DefaultEntity)5 Test (org.junit.Test)5 BigDecimal (java.math.BigDecimal)4 UnscaledValueValidator (com.qcadoo.model.internal.validators.UnscaledValueValidator)3 FieldHookDefinition (com.qcadoo.model.internal.api.FieldHookDefinition)1