Search in sources :

Example 11 with TextAttribute

use of org.openforis.idm.model.TextAttribute in project collect by openforis.

the class PatternCheckTest method testUpperCaseLetterPatternFail2.

@Test
public void testUpperCaseLetterPatternFail2() {
    Entity plot = EntityBuilder.addEntity(cluster, "plot");
    TextAttribute subplot = EntityBuilder.addValue(plot, "subplot", "4");
    ValidationResults results = validate(subplot);
    assertTrue(containsPatternCheck(results.getErrors()));
}
Also used : Entity(org.openforis.idm.model.Entity) TextAttribute(org.openforis.idm.model.TextAttribute) Test(org.junit.Test)

Example 12 with TextAttribute

use of org.openforis.idm.model.TextAttribute in project collect by openforis.

the class PatternCheckTest method testValidPattern2.

@Test
public void testValidPattern2() {
    TextAttribute id = EntityBuilder.addValue(household, "id", "X-102357");
    ValidationResults results = validate(id);
    assertFalse(containsPatternCheck(results.getErrors()));
}
Also used : TextAttribute(org.openforis.idm.model.TextAttribute) Test(org.junit.Test)

Example 13 with TextAttribute

use of org.openforis.idm.model.TextAttribute in project collect by openforis.

the class PatternCheckTest method testUpperCaseLetterPatternFail.

@Test
public void testUpperCaseLetterPatternFail() {
    Entity plot = EntityBuilder.addEntity(cluster, "plot");
    TextAttribute subplot = EntityBuilder.addValue(plot, "subplot", "d");
    ValidationResults results = validate(subplot);
    assertTrue(containsPatternCheck(results.getErrors()));
}
Also used : Entity(org.openforis.idm.model.Entity) TextAttribute(org.openforis.idm.model.TextAttribute) Test(org.junit.Test)

Example 14 with TextAttribute

use of org.openforis.idm.model.TextAttribute in project collect by openforis.

the class PatternCheckTest method testInvalidPattern3.

@Test
public void testInvalidPattern3() {
    TextAttribute id = EntityBuilder.addValue(household, "id", "X-");
    ValidationResults results = validate(id);
    assertTrue(containsPatternCheck(results.getErrors()));
}
Also used : TextAttribute(org.openforis.idm.model.TextAttribute) Test(org.junit.Test)

Example 15 with TextAttribute

use of org.openforis.idm.model.TextAttribute in project collect by openforis.

the class PatternCheckTest method testUpperCaseLetterPatternPass.

@Test
public void testUpperCaseLetterPatternPass() {
    Entity plot = EntityBuilder.addEntity(cluster, "plot");
    TextAttribute subplot = EntityBuilder.addValue(plot, "subplot", "D");
    ValidationResults results = validate(subplot);
    assertFalse(containsPatternCheck(results.getErrors()));
}
Also used : Entity(org.openforis.idm.model.Entity) TextAttribute(org.openforis.idm.model.TextAttribute) Test(org.junit.Test)

Aggregations

TextAttribute (org.openforis.idm.model.TextAttribute)20 Test (org.junit.Test)19 Entity (org.openforis.idm.model.Entity)5 CollectIntegrationTest (org.openforis.collect.CollectIntegrationTest)2 CollectRecord (org.openforis.collect.model.CollectRecord)2 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)2 RealAttribute (org.openforis.idm.model.RealAttribute)2 RealValue (org.openforis.idm.model.RealValue)2 ParsingError (org.openforis.collect.io.metadata.parsing.ParsingError)1