public void test_builder_defaults() { FraTemplate test = FraTemplate.builder() .periodToStart(Period.ofMonths(2)) .convention(FRA_GBP_LIBOR_3M) .build(); assertEquals(test.getPeriodToStart(), Period.ofMonths(2)); assertEquals(test.getPeriodToEnd(), Period.ofMonths(5)); // defaulted assertEquals(test.getConvention(), FRA_GBP_LIBOR_3M); }
/** * Obtains a template based on the specified periods and convention. * <p> * The periods from the spot date to the start date and to the end date are specified. * <p> * For example, a '2 x 5' FRA has a period to the start date of 2 months and * a period to the end date of 5 months. * * @param periodToStart the period between the spot date and the start date * @param periodToEnd the period between the spot date and the end date * @param convention the market convention * @return the template */ public static FraTemplate of(Period periodToStart, Period periodToEnd, FraConvention convention) { ArgChecker.notNull(periodToStart, "periodToStart"); ArgChecker.notNull(periodToEnd, "periodToEnd"); ArgChecker.notNull(convention, "convention"); return FraTemplate.builder() .periodToStart(periodToStart) .periodToEnd(periodToEnd) .convention(convention) .build(); }