@Test public void create_translator_from_translator_name() { ComponentResources resources = mockComponentResources(); FieldComponent field = mockFieldComponent(); Messages messages = mockMessages(); TranslatorSource ts = mockTranslatorSource(); FormSupport fs = mockFormSupport(); Translator translator = mockTranslator("map", Map.class); Messages globalMessages = mockMessages(); MessageFormatter formatter = mockMessageFormatter(); MarkupWriter writer = mockMarkupWriter(); String label = "My Label"; String message = "Formatted Message"; train_getComponent(resources, field); train_getId(resources, "myfield"); train_getContainerMessages(resources, messages); train_get(ts, "map", translator); train_getFormValidationId(fs, "myform"); train_contains(messages, "myform-myfield-map-message", false); train_contains(messages, "myfield-map-message", false); train_getMessageKey(translator, "mykey"); train_getMessageFormatter(globalMessages, "mykey", 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.createTranslator(resources, "map"); assertEquals(ft.getType(), Map.class); ft.render(writer); verify(); }
public FieldTranslator createTranslator(Field field, String overrideId, Messages overrideMessages, Locale locale, Translator translator) { MessageFormatter formatter = findFormatter(overrideId, overrideMessages, translator); return new FieldTranslatorImpl(field, translator, formatter, formSupport); }
FieldTranslatorSourceImpl implements FieldTranslatorSource { public FieldTranslator createTranslator(Field field, String overrideId, Messages overrideMessages, Locale locale, Translator translator) { MessageFormatter formatter = findFormatter(overrideId, overrideMessages, translator); return new FieldTranslatorImpl(field, translator, formatter, formSupport); } }
FieldTranslatorSourceImpl implements FieldTranslatorSource { public FieldTranslator createTranslator(Field field, String overrideId, Messages overrideMessages, Locale locale, Translator translator) { MessageFormatter formatter = findFormatter(overrideId, overrideMessages, translator); return new FieldTranslatorImpl(field, translator, formatter, formSupport); } FieldTranslatorSourceImpl(TranslatorSource translatorSource, Messages globalMessages,
            FormSupport formSupport); }
FieldTranslatorSourceImpl implements FieldTranslatorSource { public FieldTranslator createTranslator(Field field, String overrideId, Messages overrideMessages, Locale locale, Translator translator) { MessageFormatter formatter = findFormatter(overrideId, overrideMessages, translator); return new FieldTranslatorImpl(field, translator, formatter, formSupport); } FieldTranslatorSourceImpl(TranslatorSource translatorSource, Messages globalMessages,
            FormSupport formSupport); FieldTranslator createDefaultTranslator(ComponentResources resources, String parameterName); FieldTranslator createDefaultTranslator(Field field, String overrideId, Messages overrideMessages,
            Locale locale, Class propertyType, AnnotationProvider propertyAnnotations); FieldTranslator createTranslator(Field field, String overrideId, Messages overrideMessages, Locale locale,
            Translator translator); FieldTranslator createTranslator(ComponentResources resources, String translatorName); }
FieldTranslatorSourceImpl implements FieldTranslatorSource { public FieldTranslator createTranslator(Field field, String overrideId, Messages overrideMessages, Locale locale, Translator translator) { MessageFormatter formatter = findFormatter(overrideId, overrideMessages, translator); return new FieldTranslatorImpl(field, translator, formatter, formSupport); } FieldTranslatorSourceImpl(TranslatorSource translatorSource, Messages globalMessages,
            FormSupport formSupport); FieldTranslator createDefaultTranslator(ComponentResources resources, String parameterName); FieldTranslator createDefaultTranslator(Field field, String overrideId, Messages overrideMessages,
            Locale locale, Class propertyType, AnnotationProvider propertyAnnotations); FieldTranslator createTranslator(Field field, String overrideId, Messages overrideMessages, Locale locale,
            Translator translator); FieldTranslator createTranslator(ComponentResources resources, String translatorName);  }