AbstractWorldpayPaymentMethodCheckoutStepController extends AbstractCheckoutStepController { @ModelAttribute("months") public List<SelectOption> getMonths() { final List<SelectOption> months = new ArrayList<>(); months.add(new SelectOption("01", "1")); months.add(new SelectOption("02", "2")); months.add(new SelectOption("03", "3")); months.add(new SelectOption("04", "4")); months.add(new SelectOption("05", "5")); months.add(new SelectOption("06", "6")); months.add(new SelectOption("07", "7")); months.add(new SelectOption("08", "8")); months.add(new SelectOption("09", "9")); months.add(new SelectOption("10", "10")); months.add(new SelectOption("11", "11")); months.add(new SelectOption("12", "12")); return months; }  @ModelAttribute("billingCountries") Collection<CountryData> getBillingCountries(); @ModelAttribute("cardTypes") Collection<CardTypeData> getCardTypes(); @ModelAttribute("months") List<SelectOption> getMonths(); @ModelAttribute("expiryYears") List<SelectOption> getExpiryYears(); WorldpayPaymentCheckoutFacade getWorldpayPaymentCheckoutFacade(); WorldpayHostedOrderFacade getWorldpayHostedOrderFacade(); WorldpayAdditionalInfoFacade getWorldpayAdditionalInfoFacade(); WorldpayMerchantConfigDataFacade getWorldpayMerchantConfigDataFacade();  }
@Test public void shouldPopulateModelWithAllMonths() { final List<AbstractCheckoutController.SelectOption> result = testObj.getMonths(); for (int i = 0; i < 11; i++) { if (i < 9) { assertEquals(String.format("0%s", i + 1), result.get(i).getCode()); } else { assertEquals(String.format("%s", i + 1), result.get(i).getCode()); } assertEquals(String.format("%s", i + 1), result.get(i).getName()); } }