public void test_builder() { TermDepositTemplate test = TermDepositTemplate.builder() .convention(CONVENTION) .depositPeriod(DEPOSIT_PERIOD) .build(); assertEquals(test.getConvention(), CONVENTION); assertEquals(test.getDepositPeriod(), DEPOSIT_PERIOD); }
/** * Obtains a template based on the specified period and convention. * * @param depositPeriod the period between the start date and the end date * @param convention the market convention * @return the template */ public static TermDepositTemplate of(Period depositPeriod, TermDepositConvention convention) { ArgChecker.notNull(depositPeriod, "depositPeriod"); ArgChecker.notNull(convention, "convention"); return TermDepositTemplate.builder() .depositPeriod(depositPeriod) .convention(convention) .build(); }
public void test_builder_negativePeriod() { assertThrowsIllegalArg(() -> TermDepositTemplate.builder() .convention(CONVENTION) .depositPeriod(Period.ofMonths(-2)) .build()); }