Search in sources :

Example 21 with Field

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

the class RequiredTest method blank_value.

@Test
public void blank_value() {
    MessageFormatter formatter = mockMessageFormatter();
    Field field = mockFieldWithLabel("My Field");
    train_format(formatter, "{message}", "My Field");
    Html5Support html5Support = mockHtml5Support();
    replay();
    try {
        new Required(null, html5Support).validate(field, null, formatter, "");
        unreachable();
    } catch (ValidationException ex) {
        assertEquals(ex.getMessage(), "{message}");
    }
    verify();
}
Also used : Field(org.apache.tapestry5.Field) Html5Support(org.apache.tapestry5.services.Html5Support) ValidationException(org.apache.tapestry5.ValidationException) MessageFormatter(org.apache.tapestry5.commons.MessageFormatter) Test(org.testng.annotations.Test)

Example 22 with Field

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

the class RequiredTest method empty_collection_value.

@Test
public void empty_collection_value() {
    MessageFormatter formatter = mockMessageFormatter();
    Field field = mockFieldWithLabel("My Field");
    train_format(formatter, "{message}", "My Field");
    Html5Support html5Support = mockHtml5Support();
    replay();
    try {
        new Required(null, html5Support).validate(field, null, formatter, Arrays.asList());
        unreachable();
    } catch (ValidationException ex) {
        assertEquals(ex.getMessage(), "{message}");
    }
    verify();
}
Also used : Field(org.apache.tapestry5.Field) Html5Support(org.apache.tapestry5.services.Html5Support) ValidationException(org.apache.tapestry5.ValidationException) MessageFormatter(org.apache.tapestry5.commons.MessageFormatter) Test(org.testng.annotations.Test)

Example 23 with Field

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

the class RequiredTest method non_blank_value.

@Test
public void non_blank_value() throws Exception {
    MessageFormatter formatter = mockMessageFormatter();
    Field field = mockField();
    Html5Support html5Support = mockHtml5Support();
    replay();
    new Required(null, html5Support).validate(field, null, formatter, "not null");
    verify();
}
Also used : Field(org.apache.tapestry5.Field) Html5Support(org.apache.tapestry5.services.Html5Support) MessageFormatter(org.apache.tapestry5.commons.MessageFormatter) Test(org.testng.annotations.Test)

Example 24 with Field

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

the class RequiredTest method not_empty_collection_value.

@Test
public void not_empty_collection_value() throws Exception {
    MessageFormatter formatter = mockMessageFormatter();
    Field field = mockField();
    Html5Support html5Support = mockHtml5Support();
    replay();
    new Required(null, html5Support).validate(field, null, formatter, Arrays.asList("A", "B"));
    verify();
}
Also used : Field(org.apache.tapestry5.Field) Html5Support(org.apache.tapestry5.services.Html5Support) MessageFormatter(org.apache.tapestry5.commons.MessageFormatter) Test(org.testng.annotations.Test)

Example 25 with Field

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

the class FieldTranslatorSourceImplTest method create_default_translator_with_name_and_null_key.

@Test
public void create_default_translator_with_name_and_null_key() {
    Field field = mockField();
    Messages messages = mockMessages();
    Locale locale = Locale.ENGLISH;
    Class propertyType = Map.class;
    TranslatorSource ts = mockTranslatorSource();
    FormSupport fs = mockFormSupport();
    Translator translator = mockTranslator("maptrans", Map.class);
    Messages globalMessages = mockMessages();
    MessageFormatter formatter = mockMessageFormatter();
    MarkupWriter writer = mockMarkupWriter();
    String label = "Field Label";
    String message = "Woops, did it again.";
    AnnotationProvider ap = mockAnnotationProvider(null);
    train_findByType(ts, propertyType, translator);
    train_getFormValidationId(fs, "myform");
    train_contains(messages, "myform-myfield-maptrans-message", false);
    train_contains(messages, "myfield-maptrans-message", false);
    train_getMessageKey(translator, null);
    train_getMessageFormatter(globalMessages, "maptrans-message", formatter);
    train_getLabel(field, label);
    train_format(formatter, message, label);
    translator.render(field, message, writer, fs);
    replay();
    FieldTranslatorSource source = new FieldTranslatorSourceImpl(ts, globalMessages, fs);
    FieldTranslator ft = source.createDefaultTranslator(field, "myfield", messages, locale, propertyType, ap);
    assertEquals(ft.getType(), Map.class);
    ft.render(writer);
    verify();
}
Also used : Locale(java.util.Locale) Messages(org.apache.tapestry5.commons.Messages) AnnotationProvider(org.apache.tapestry5.commons.AnnotationProvider) FieldTranslator(org.apache.tapestry5.FieldTranslator) MessageFormatter(org.apache.tapestry5.commons.MessageFormatter) MarkupWriter(org.apache.tapestry5.MarkupWriter) FormSupport(org.apache.tapestry5.services.FormSupport) TranslatorSource(org.apache.tapestry5.services.TranslatorSource) FieldTranslatorSource(org.apache.tapestry5.services.FieldTranslatorSource) Field(org.apache.tapestry5.Field) FieldTranslator(org.apache.tapestry5.FieldTranslator) Translator(org.apache.tapestry5.Translator) FieldTranslatorSource(org.apache.tapestry5.services.FieldTranslatorSource) Map(java.util.Map) 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