Package br.com.caelum.stella

Examples of br.com.caelum.stella.ValidationMessage


    protected List<ValidationMessage> generateValidationMessages(
            List<InvalidValue> invalidValues) {
        List<ValidationMessage> messages = new ArrayList<ValidationMessage>();
        for (InvalidValue invalidValue : invalidValues) {
            ValidationMessage message = messageProducer
                    .getMessage(invalidValue);
            messages.add(message);
        }
        return messages;
    }
View Full Code Here


    private List<ValidationMessage> generateValidationMessages(
            List<InvalidValue> invalidValues) {
        List<ValidationMessage> messages = new ArrayList<ValidationMessage>();
        for (InvalidValue invalidValue : invalidValues) {
            ValidationMessage message = messageProducer
                    .getMessage(invalidValue);
            messages.add(message);
        }
        return messages;
    }
View Full Code Here

    protected List<ValidationMessage> generateValidationMessages(
            List<InvalidValue> invalidValues) {
        List<ValidationMessage> messages = new ArrayList<ValidationMessage>();
        for (InvalidValue invalidValue : invalidValues) {
            ValidationMessage message = messageProducer
                    .getMessage(invalidValue);
            messages.add(message);
        }
        return messages;
    }
View Full Code Here

        field.setAccessible(true);
        FakeConstraint constraint = field.getAnnotation(FakeConstraint.class);

        {
            AnnotationMessageProducer producer = new AnnotationMessageProducer(constraint);
            ValidationMessage validationMessage = producer.getMessage(Errors.ANY);
            Assert.assertEquals(constraint.message(), validationMessage.getMessage());
        }
        {
            AnnotationMessageProducer producer = new AnnotationMessageProducer(constraint);
            ValidationMessage validationMessage = producer.getMessage(Errors.OTHER);
            Assert.assertEquals(constraint.message(), validationMessage.getMessage());
        }
    }
View Full Code Here

        field.setAccessible(true);
        ConstraintWithoutMessage constraint = field.getAnnotation(ConstraintWithoutMessage.class);

        AnnotationMessageProducer producer = new AnnotationMessageProducer(constraint);
        try {
            @SuppressWarnings("unused")
            ValidationMessage validationMessage = producer.getMessage(Errors.ANY);
            fail();
        } catch (IllegalArgumentException e) {
            // ok
        } catch (Exception e) {
View Full Code Here

    @Test
    public void testGetValidationMessagesT() {
        Mockery mockery = new Mockery();
        final MessageProducer messageProducer = mockery.mock(MessageProducer.class);
        final InvalidValue invalidValue = mockery.mock(InvalidValue.class);
        final ValidationMessage validationMessage = mockery.mock(ValidationMessage.class);

        mockery.checking(new Expectations() {
            {
                exactly(1).of(messageProducer).getMessage(invalidValue);
                will(returnValue(validationMessage));
View Full Code Here

    @Test
    public void testAssertValidShouldThrowInvalidStateExpectionWhenComesAnInvalidValue() {
        Mockery mockery = new Mockery();
        final MessageProducer messageProducer = mockery.mock(MessageProducer.class);
        final InvalidValue invalidValue = mockery.mock(InvalidValue.class);
        final ValidationMessage validationMessage = mockery.mock(ValidationMessage.class);

        mockery.checking(new Expectations() {
            {
                exactly(1).of(messageProducer).getMessage(invalidValue);
                will(returnValue(validationMessage));
View Full Code Here

    public void shouldReturnCorrectValidationMessage() {
        Mockery mockery = new Mockery();
        final MessageProducer messageProducer = mockery.mock(MessageProducer.class);
        LengthValidator lengthValidator = new LengthValidator(messageProducer, 2);
        String message = "O tamanho da entrada é inválido.";
        final ValidationMessage validationMessage = new SimpleValidationMessage(message);
        mockery.checking(new Expectations() {
            {
                one(messageProducer).getMessage(with(equal(new LengthError(2))));
                will(returnValue(validationMessage));
            }
View Full Code Here

    }

    private List<ValidationMessage> generateValidationMessages(List<InvalidValue> invalidValues) {
        List<ValidationMessage> messages = new ArrayList<ValidationMessage>();
        for (InvalidValue invalidValue : invalidValues) {
            ValidationMessage message = messageProducer.getMessage(invalidValue);
            messages.add(message);
        }
        return messages;
    }
View Full Code Here

     */
    public List<ValidationMessage> generateValidationMessages(
            List<InvalidValue> invalidValues) {
        List<ValidationMessage> messages = new ArrayList<ValidationMessage>();
        for (InvalidValue invalidValue : invalidValues) {
            ValidationMessage message = messageProducer
                    .getMessage(invalidValue);
            messages.add(message);
        }
        return messages;
    }
View Full Code Here

TOP

Related Classes of br.com.caelum.stella.ValidationMessage

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.