Examples of LengthError


Examples of br.com.caelum.stella.validation.error.LengthError

        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));
            }
        });
        List<ValidationMessage> invalidMessages = lengthValidator.invalidMessagesFor(12345);
        Assert.assertEquals(1, invalidMessages.size());
View Full Code Here

Examples of br.com.caelum.stella.validation.error.LengthError

    }

    private List<InvalidValue> getInvalidValuesFor(Object object) {
        List<InvalidValue> messages = new ArrayList<InvalidValue>();
        if (object.toString().length() != validLength) {
            messages.add(new LengthError(validLength));
        }
        return messages;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.