use of org.springframework.binding.message.MessageContext in project head by mifos.
the class LoanAccountFormBeanTest method shouldContainValidationMessageOnLoanPurposeFieldWhenFieldIsMandatoryAndNotSelected.
@Test
public void shouldContainValidationMessageOnLoanPurposeFieldWhenFieldIsMandatoryAndNotSelected() {
// setup
loanAccountFormBean.setPurposeOfLoanMandatory(true);
loanAccountFormBean.setLoanPurposeId(null);
// exercise test
loanAccountFormBean.validateEnterAccountDetailsStep(context);
// verification
MessageContext messageContext = context.getMessageContext();
Message[] messages = messageContext.getAllMessages();
assertThat(messages.length, is(1));
Message message = messages[0];
assertThat(message.getSource().toString(), is("loanPurposeId"));
assertThat(message.getText().toString(), containsString("loanAccountFormBean.PurposeOfLoan.invalid"));
}
use of org.springframework.binding.message.MessageContext in project head by mifos.
the class LoanAccountFormBeanTest method shouldContainValidationMessageOnDisbursementDateDayFieldWhenDateIsInvalid.
@Test
public void shouldContainValidationMessageOnDisbursementDateDayFieldWhenDateIsInvalid() {
// setup
loanAccountFormBean.setDisbursementDateDD(32);
loanAccountFormBean.setDisbursementDateMM(1);
loanAccountFormBean.setDisbursementDateYY(2011);
// exercise test
loanAccountFormBean.validateEnterAccountDetailsStep(context);
// verification
MessageContext messageContext = context.getMessageContext();
Message[] messages = messageContext.getAllMessages();
assertThat(messages.length, is(1));
Message message = messages[0];
assertThat(message.getSource().toString(), is("disbursementDateDD"));
assertThat(message.getText().toString(), containsString("loanAccountFormBean.DisbursalDate.invalid"));
}
use of org.springframework.binding.message.MessageContext in project head by mifos.
the class LoanAccountFormBeanTest method shouldContainValidationMessageOnAmountFieldWhenAmountViolatesAllowedRange.
@Test
public void shouldContainValidationMessageOnAmountFieldWhenAmountViolatesAllowedRange() {
// setup
loanAccountFormBean.setAmount(Double.valueOf("0.0"));
// exercise test
loanAccountFormBean.validateEnterAccountDetailsStep(context);
// verification
MessageContext messageContext = context.getMessageContext();
Message[] messages = messageContext.getAllMessages();
assertThat(messages.length, is(1));
Message message = messages[0];
assertThat(message.getSource().toString(), is("amount"));
assertThat(message.getText().toString(), containsString("loanAccountFormBean.Amount.invalid"));
}
use of org.springframework.binding.message.MessageContext in project head by mifos.
the class ClearOverpaymentFormBean method validateEnterOverpaymentClearStep.
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "REC_CATCH_EXCEPTION", justification = "should be the exception thrown by jodatime but not sure what it is right now.")
public void validateEnterOverpaymentClearStep(ValidationContext context) {
MessageContext messages = context.getMessageContext();
validator.validate(this, messages);
}
use of org.springframework.binding.message.MessageContext in project head by mifos.
the class LoanAccountFormBeanTest method shouldContainValidationMessageOnNumberOfInstallmentsFieldWhenNumberOfInstallmentsViolatesAllowedRange.
@Test
public void shouldContainValidationMessageOnNumberOfInstallmentsFieldWhenNumberOfInstallmentsViolatesAllowedRange() {
// setup
loanAccountFormBean.setNumberOfInstallments(100);
// exercise test
loanAccountFormBean.validateEnterAccountDetailsStep(context);
// verification
MessageContext messageContext = context.getMessageContext();
Message[] messages = messageContext.getAllMessages();
assertThat(messages.length, is(1));
Message message = messages[0];
assertThat(message.getSource().toString(), is("numberOfInstallments"));
assertThat(message.getText().toString(), containsString("loanAccountFormBean.NumberOfInstallments.invalid"));
}
Aggregations