Search in sources :

Example 16 with Field

use of com.google.firestore.admin.v1.Field in project tapestry-5 by apache.

the class MinLengthTest method short_value.

@Test
public void short_value() throws Exception {
    String label = "My Field";
    Field field = mockFieldWithLabel(label);
    MessageFormatter formatter = mockMessageFormatter();
    String value = "Now the student has become the master.";
    String message = "{message}";
    Integer constraint = value.length() + 1;
    train_format(formatter, message, constraint, label);
    replay();
    MinLength validator = new MinLength(null);
    try {
        validator.validate(field, constraint, formatter, value);
        unreachable();
    } catch (ValidationException ex) {
        assertEquals(ex.getMessage(), message);
    }
    verify();
}
Also used : Field(org.apache.tapestry5.Field) ValidationException(org.apache.tapestry5.ValidationException) MessageFormatter(org.apache.tapestry5.commons.MessageFormatter) Test(org.testng.annotations.Test)

Example 17 with Field

use of com.google.firestore.admin.v1.Field in project tapestry-5 by apache.

the class MinTest method large_enough.

@Test
public void large_enough() throws Exception {
    Field field = mockField();
    MessageFormatter formatter = mockMessageFormatter();
    Long constraint = 50L;
    Min validator = new Min(null, mockHtml5Support());
    replay();
    for (int value = 50; value < 52; value++) validator.validate(field, constraint, formatter, value);
    verify();
}
Also used : Field(org.apache.tapestry5.Field) MessageFormatter(org.apache.tapestry5.commons.MessageFormatter) Test(org.testng.annotations.Test)

Example 18 with Field

use of com.google.firestore.admin.v1.Field in project tapestry-5 by apache.

the class MinTest method value_too_small.

@Test
public void value_too_small() throws Exception {
    String label = "My Field";
    Field field = mockFieldWithLabel(label);
    MessageFormatter formatter = mockMessageFormatter();
    String message = "{message}";
    Long constraint = 100l;
    Number value = 99;
    train_format(formatter, message, constraint, label);
    Min validator = new Min(null, mockHtml5Support());
    replay();
    try {
        validator.validate(field, constraint, formatter, value);
        unreachable();
    } catch (ValidationException ex) {
        assertEquals(ex.getMessage(), message);
    }
    verify();
}
Also used : Field(org.apache.tapestry5.Field) ValidationException(org.apache.tapestry5.ValidationException) MessageFormatter(org.apache.tapestry5.commons.MessageFormatter) Test(org.testng.annotations.Test)

Example 19 with Field

use of com.google.firestore.admin.v1.Field in project tapestry-5 by apache.

the class RegexpTest method matching_pattern.

@Test
public void matching_pattern() throws Exception {
    Field field = mockField();
    MessageFormatter formatter = mockMessageFormatter();
    Pattern constraint = Pattern.compile("\\d{4}");
    replay();
    Regexp validator = new Regexp(null);
    validator.validate(field, constraint, formatter, "1234");
    verify();
}
Also used : Field(org.apache.tapestry5.Field) Pattern(java.util.regex.Pattern) MessageFormatter(org.apache.tapestry5.commons.MessageFormatter) Test(org.testng.annotations.Test)

Example 20 with Field

use of com.google.firestore.admin.v1.Field in project tapestry-5 by apache.

the class ValidationTrackerImplTest method data_survives_serialization.

@Test
public void data_survives_serialization() throws Exception {
    Field fielda = newFieldWithControlName("fieldA");
    Field fieldb = newFieldWithControlName("fieldB");
    Field fieldc = newFieldWithControlName("fieldC");
    replay();
    ValidationTracker tracker = new ValidationTrackerImpl();
    tracker.recordError("one");
    tracker.recordError(fieldb, "fieldb: two");
    tracker.recordError("three");
    tracker.recordError(fielda, "fielda: four");
    ValidationTracker copy = cloneBySerialiation(tracker);
    copy.recordError(fieldc, "fieldc: five");
    assertEquals(copy.getErrors(), Arrays.asList("one", "three", "fieldb: two", "fielda: four", "fieldc: five"));
    verify();
}
Also used : Field(org.apache.tapestry5.Field) ValidationTracker(org.apache.tapestry5.ValidationTracker) ValidationTrackerImpl(org.apache.tapestry5.ValidationTrackerImpl) Test(org.testng.annotations.Test)

Aggregations

Field (io.atlasmap.v2.Field)221 FieldGroup (io.atlasmap.v2.FieldGroup)86 Test (org.junit.jupiter.api.Test)67 SimpleField (io.atlasmap.v2.SimpleField)62 Field (org.apache.tapestry5.Field)46 JavaField (io.atlasmap.java.v2.JavaField)45 ArrayList (java.util.ArrayList)42 Mapping (io.atlasmap.v2.Mapping)39 Test (org.testng.annotations.Test)39 AtlasPath (io.atlasmap.core.AtlasPath)29 ConstantField (io.atlasmap.v2.ConstantField)29 JavaEnumField (io.atlasmap.java.v2.JavaEnumField)26 AtlasException (io.atlasmap.api.AtlasException)25 JsonField (io.atlasmap.json.v2.JsonField)25 MessageFormatter (org.apache.tapestry5.commons.MessageFormatter)25 PropertyField (io.atlasmap.v2.PropertyField)22 AtlasMapping (io.atlasmap.v2.AtlasMapping)21 KafkaConnectField (io.atlasmap.kafkaconnect.v2.KafkaConnectField)19 AtlasInternalSession (io.atlasmap.spi.AtlasInternalSession)19 Head (io.atlasmap.spi.AtlasInternalSession.Head)18