Search in sources :

Example 16 with TextAttribute

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

the class PatternCheckTest method testValidPattern3.

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

Example 17 with TextAttribute

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

the class PatternCheckTest method testInvalidPattern.

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

Example 18 with TextAttribute

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

the class PatternCheckTest method testInvalidPattern2.

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

Example 19 with TextAttribute

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

the class UniquenessCheckTest method testNotUniqueMapSheet.

@Test
public void testNotUniqueMapSheet() {
    EntityBuilder.addValue(cluster, MAP_SHEET, "TomTom1");
    EntityBuilder.addValue(cluster, MAP_SHEET, "TomTom2");
    TextAttribute mapSheet3 = EntityBuilder.addValue(cluster, MAP_SHEET, "TomTom1");
    ValidationResults results = validate(mapSheet3);
    Assert.assertTrue(containsUniquenessError(results.getErrors(), MAP_SHEET));
}
Also used : TextAttribute(org.openforis.idm.model.TextAttribute) Test(org.junit.Test)

Example 20 with TextAttribute

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

the class UniquenessCheckTest method testUniqueSingleMapSheet.

@Test
public void testUniqueSingleMapSheet() {
    TextAttribute mapSheet1 = EntityBuilder.addValue(cluster, MAP_SHEET, "TomTom1");
    ValidationResults results = validate(mapSheet1);
    Assert.assertFalse(containsUniquenessError(results.getErrors(), MAP_SHEET));
}
Also used : 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