Search in sources :

Example 1 with TestValueBinder

use of com.haulmont.cuba.gui.components.AbstractComponentTestCase.TestValueBinder in project cuba by cuba-platform.

the class FieldGroupTest method setUp.

@BeforeEach
public void setUp() {
    addEntityPackage("com.haulmont.cuba");
    setupInfrastructure();
    fieldFactory = new TestFieldGroupFieldFactoryImpl();
    this.valueBinder = new TestValueBinder(beanLocator, messageTools, metadata.getTools(), beanValidation, security);
    this.optionsBinder = new OptionsBinder();
    new Expectations() {

        {
            AppBeans.get(BackgroundWorker.NAME);
            result = backgroundWorker;
            minTimes = 0;
            AppBeans.get(BackgroundWorker.class);
            result = backgroundWorker;
            minTimes = 0;
            AppBeans.get(BackgroundWorker.NAME, BackgroundWorker.class);
            result = backgroundWorker;
            minTimes = 0;
            AppBeans.get(FieldGroupFieldFactory.NAME);
            result = fieldFactory;
            minTimes = 0;
            AppBeans.get(FieldGroupFieldFactory.class);
            result = fieldFactory;
            minTimes = 0;
            AppBeans.get(FieldGroupFieldFactory.NAME, FieldGroupFieldFactory.class);
            result = fieldFactory;
            minTimes = 0;
            applicationContext.getAutowireCapableBeanFactory();
            result = beanFactory;
            minTimes = 0;
            beanFactory.autowireBean(any);
            result = new Delegate() {

                @SuppressWarnings("unused")
                void autowireBean(java.lang.Object o) throws org.springframework.beans.BeansException {
                    autowireUiComponent((Component) o);
                }
            };
            minTimes = 0;
            userSessionSource.getLocale();
            result = Locale.ENGLISH;
            minTimes = 0;
            beanLocator.get(MetadataTools.NAME);
            result = metadata.getTools();
            minTimes = 0;
            beanLocator.get(ValueBinder.NAME);
            result = valueBinder;
            minTimes = 0;
            beanLocator.get(ValueBinder.class);
            result = valueBinder;
            minTimes = 0;
            beanLocator.get(ValueBinder.NAME, ValueBinder.class);
            result = valueBinder;
            minTimes = 0;
            beanLocator.get(OptionsBinder.NAME);
            result = optionsBinder;
            minTimes = 0;
            beanLocator.get(OptionsBinder.NAME, OptionsBinder.class);
            result = optionsBinder;
            minTimes = 0;
            beanLocator.get(Configuration.NAME);
            result = configuration;
            minTimes = 0;
            beanLocator.get(FormatStringsRegistry.NAME);
            result = formatStringsRegistry;
            minTimes = 0;
        }
    };
    initExpectations();
    messages.init();
    DefaultComponentGenerationStrategy strategy = new DefaultComponentGenerationStrategy(messages, null);
    UiComponentsGenerator uiComponentsGenerator = new UiComponentsGenerator() {

        @Override
        protected List<ComponentGenerationStrategy> getComponentGenerationStrategies() {
            return Collections.singletonList(strategy);
        }
    };
    uiComponents = createComponentsFactory();
    strategy.setUiComponents(uiComponents);
    fieldFactory.setUiComponentsGenerator(uiComponentsGenerator);
}
Also used : Expectations(mockit.Expectations) DefaultComponentGenerationStrategy(com.haulmont.cuba.gui.components.factories.DefaultComponentGenerationStrategy) DefaultComponentGenerationStrategy(com.haulmont.cuba.gui.components.factories.DefaultComponentGenerationStrategy) TestValueBinder(com.haulmont.cuba.gui.components.AbstractComponentTestCase.TestValueBinder) OptionsBinder(com.haulmont.cuba.gui.components.data.options.OptionsBinder) Delegate(mockit.Delegate) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

TestValueBinder (com.haulmont.cuba.gui.components.AbstractComponentTestCase.TestValueBinder)1 OptionsBinder (com.haulmont.cuba.gui.components.data.options.OptionsBinder)1 DefaultComponentGenerationStrategy (com.haulmont.cuba.gui.components.factories.DefaultComponentGenerationStrategy)1 Delegate (mockit.Delegate)1 Expectations (mockit.Expectations)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1