VariableNotionalProvider implements NotionalProvider { public VariableNotionalProvider withZonedDateTime(List<ZonedDateTime> dateList) { ArgumentChecker.notEmpty(dateList, "dates"); int nDates = dateList.size(); ArgumentChecker.isTrue(_notionals.length == nDates, "zonedDates and notionals should have the same length"); LocalDate[] dates = new LocalDate[nDates]; for (int i = 0; i < nDates; ++i) { dates[i] = dateList.get(i).toLocalDate(); } return new VariableNotionalProvider(dates, _notionals); } VariableNotionalProvider(LocalDate[] dates, double[] notionals);  VariableNotionalProvider(double[] notionals); VariableNotionalProvider withZonedDateTime(List<ZonedDateTime> dateList); @Override double getAmount(final LocalDate date); double[] getNotionals(); LocalDate[] getDates();  }
@Test(expectedExceptions = IllegalArgumentException.class) public void wrongDateSet() { double[] notionals = new double[] {100.0, 90.0 }; ArrayList<ZonedDateTime> list = new ArrayList<>(); list.add(ZonedDateTime.of(2014, 7, 21, 0, 0, 0, 0, ZoneId.of("UTC"))); VariableNotionalProvider provider = new VariableNotionalProvider(notionals); provider.withZonedDateTime(list); }