Package com.alibaba.citrus.service.form.impl.validation

Examples of com.alibaba.citrus.service.form.impl.validation.MyValidator


        assertFieldContext(fieldContext);
    }

    @Test
    public void validatorMessageContext() throws Exception {
        MessageContext validatorContext = MessageContextFactory.newInstance(field1, new MyValidator(true));

        assertSame(field1.getMessageContext(), validatorContext.getParentContext());
        assertGenericContext(validatorContext);
        assertFormContext(validatorContext);
        assertGroupContext(validatorContext);
View Full Code Here


                                                                                                        AbstractCompositeValidatorTests<V> {
    @Test
    public void init_hiddenAllOfValidator() throws Exception {
        // 2 validators
        V v = newValidatorFor_AbstractSimpleCompositeValidatorTests();
        v.setValidators(createValidatorList(new MyValidator(), new MyValidator()));
        v.setMessage("message");
        v.afterPropertiesSet();

        assertEquals(1, v.getValidators().size());
        assertThat(v.getValidator(), instanceOf(AllOfValidator.class));
        assertSame(v.getValidator(), v.getValidators().get(0));

        // 1 validators
        MyValidator myValidator = new MyValidator();

        v = newValidatorFor_AbstractSimpleCompositeValidatorTests();
        v.setValidators(createValidatorList((Validator) myValidator));
        v.setMessage("message");
        v.afterPropertiesSet();
View Full Code Here

            assertThat(e, exception("no validators"));
        }

        // wrong validators
        v = newValidator();
        v.setValidators(createValidatorList((Validator) new MyValidator()));

        try {
            v.afterPropertiesSet();
            fail();
        } catch (IllegalArgumentException e) {
            assertThat(e, exception("expected <when>"));
        }

        v = newValidator();
        v.setValidators(createValidatorList(new ChooseValidator.When(), new ChooseValidator.Otherwise(),
                                            new ChooseValidator.When()));

        try {
            v.afterPropertiesSet();
            fail();
        } catch (IllegalArgumentException e) {
            assertThat(e, exception("expected <when>"));
        }

        v = newValidator();
        v.setValidators(createValidatorList(new ChooseValidator.When(), new MyValidator()));

        try {
            v.afterPropertiesSet();
            fail();
        } catch (IllegalArgumentException e) {
View Full Code Here

        } catch (IllegalArgumentException e) {
            assertThat(e, exception("no validators"));
        }

        v = new ChooseValidator.When();
        v.setValidators(createValidatorList((Validator) new MyValidator()));

        try {
            v.afterPropertiesSet();
            fail();
        } catch (IllegalArgumentException e) {
View Full Code Here

                                                                                            AbstractValidatorTests<V> {
    @Test
    public void init_setValidators() {
        V v = newValidatorFor_AbstractCompositeValidatorTests();

        v.setValidators(createValidatorList(new MyValidator(), new MyValidator(), new MyValidator()));

        assertEquals(3, v.getValidators().size());

        // unmodifiable
        try {
View Full Code Here

    }

    @Test
    public void init_noCondition() throws Exception {
        IfValidator v = newValidator();
        v.setValidators(createValidatorList((Validator) new MyValidator()));

        try {
            v.afterPropertiesSet();
            fail();
        } catch (IllegalArgumentException e) {
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.service.form.impl.validation.MyValidator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.