### Question:
PaymentLimits { public void setDayLimitInEuro(Integer dayLimitInEuro) { this.dayLimitInEuro = dayLimitInEuro; } PaymentLimits();  PaymentLimits(PaymentLimits paymentLimits); String getMonthLimitFormatted(); String getWeekLimitFormatted(); String getDayLimitFormatted(); Integer getMonthLimitInEuro(); void setMonthLimitInEuro(Integer monthLimitInEuro); Integer getNewMonthLimitInEuro(); void setNewMonthLimitInEuro(Integer newMonthLimitInEuro); ZonedDateTime getNewMonthLimitValidFrom(); void setNewMonthLimitValidFrom(ZonedDateTime newMonthLimitValidFrom); Integer getWeekLimitInEuro(); void setWeekLimitInEuro(Integer weekLimitInEuro); Integer getNewWeekLimitInEuro(); void setNewWeekLimitInEuro(Integer newWeekLimitInEuro); ZonedDateTime getNewWeekLimitValidFrom(); void setNewWeekLimitValidFrom(ZonedDateTime newWeekLimitValidFrom); Integer getDayLimitInEuro(); void setDayLimitInEuro(Integer dayLimitInEuro); Integer getNewDayLimitInEuro(); void setNewDayLimitInEuro(Integer newDayLimitInEuro); ZonedDateTime getNewDayLimitValidFrom(); void setNewDayLimitValidFrom(ZonedDateTime newDayLimitValidFrom); @Override boolean equals(Object o); @Override int hashCode(); static final Integer MAX_MONTH_LIMIT_IN_EURO; }### Answer:
@Test public void testDayLimit() { PaymentLimits cut = new PaymentLimits(); cut.setDayLimitInEuro(2000); try { ValidationController.get(PaymentLimits.class).processBeanValidationForProperty(cut, "dayLimitInEuro"); fail("Invalid daylimit not recognized"); } catch (ConstraintViolationException ex) { List<ConstraintViolation> errors = new ArrayList<>(ex.getConstraintViolations()); errors.sort(Comparator.comparing(ConstraintViolation::getMessageTemplate)); assertThat(errors.get(0).getMessageTemplate(), is("{payment_day_limit_max}")); } cut.setDayLimitInEuro(999); try { ValidationController.get(PaymentLimits.class).processBeanValidationForProperty(cut, "dayLimitInEuro"); } catch (ConstraintViolationException ex) { fail("Correct daylimit not recognized"); } }