### Question:
IborCapFloorLeg implements Resolvable<ResolvedIborCapFloorLeg>, ImmutableBean, Serializable { public static IborCapFloorLeg.Builder builder() { return new IborCapFloorLeg.Builder(); } @ImmutableConstructor private  IborCapFloorLeg(
      PayReceive payReceive,
      PeriodicSchedule paymentSchedule,
      DaysAdjustment paymentDateOffset,
      Currency currency,
      ValueSchedule notional,
      IborRateCalculation calculation,
      ValueSchedule capSchedule,
      ValueSchedule floorSchedule); AdjustableDate getStartDate(); AdjustableDate getEndDate(); IborIndex getIndex(); @Override ResolvedIborCapFloorLeg resolve(ReferenceData refData); static IborCapFloorLeg.Meta meta(); static IborCapFloorLeg.Builder builder(); @Override IborCapFloorLeg.Meta metaBean(); PayReceive getPayReceive(); PeriodicSchedule getPaymentSchedule(); DaysAdjustment getPaymentDateOffset(); Currency getCurrency(); ValueSchedule getNotional(); IborRateCalculation getCalculation(); Optional<ValueSchedule> getCapSchedule(); Optional<ValueSchedule> getFloorSchedule(); Builder toBuilder(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void test_builder_fail() { assertThatIllegalArgumentException() .isThrownBy(() -> IborCapFloorLeg.builder() .calculation(RATE_CALCULATION) .capSchedule(CAP) .floorSchedule(FLOOR) .notional(NOTIONAL) .paymentSchedule(SCHEDULE) .payReceive(RECEIVE) .build()); assertThatIllegalArgumentException() .isThrownBy(() -> IborCapFloorLeg.builder() .calculation(RATE_CALCULATION) .notional(NOTIONAL) .paymentSchedule(PeriodicSchedule.builder() .startDate(START) .endDate(END) .frequency(FREQUENCY) .businessDayAdjustment(BUSS_ADJ) .build()) .payReceive(RECEIVE) .build()); assertThatIllegalArgumentException() .isThrownBy(() -> IborCapFloorLeg.builder() .calculation(RATE_CALCULATION) .capSchedule(CAP) .currency(GBP) .notional(NOTIONAL) .paymentDateOffset(PAYMENT_OFFSET) .paymentSchedule(PeriodicSchedule.builder() .startDate(START) .endDate(END) .frequency(FREQUENCY) .businessDayAdjustment(BUSS_ADJ) .stubConvention(StubConvention.SHORT_FINAL) .build()) .payReceive(PAY) .build()); }
@Test public void coverage() { IborCapFloorLeg test1 = IborCapFloorLeg.builder() .calculation(RATE_CALCULATION) .floorSchedule(FLOOR) .notional(NOTIONAL) .paymentSchedule(SCHEDULE) .payReceive(RECEIVE) .build(); coverImmutableBean(test1); IborCapFloorLeg test2 = IborCapFloorLeg.builder() .calculation(IborRateCalculation.of(GBP_LIBOR_6M)) .capSchedule(CAP) .notional(ValueSchedule.of(1000)) .paymentDateOffset(PAYMENT_OFFSET) .paymentSchedule(PeriodicSchedule.builder() .startDate(START) .endDate(END) .frequency(Frequency.P6M) .businessDayAdjustment(BUSS_ADJ) .build()) .payReceive(PAY) .build(); coverBeanEquals(test1, test2); }
@Test public void test_serialization() { IborCapFloorLeg test = IborCapFloorLeg.builder() .calculation(RATE_CALCULATION) .floorSchedule(FLOOR) .notional(NOTIONAL) .paymentSchedule(SCHEDULE) .payReceive(RECEIVE) .build(); assertSerialization(test); }