### Question:
SwapMeasureCalculations { ScenarioArray<LegAmounts> legInitialNotional( ResolvedSwapTrade trade, RatesScenarioMarketData marketData) { LegAmounts legInitialNotional = legInitialNotional(trade); return ScenarioArray.ofSingleValue(marketData.getScenarioCount(), legInitialNotional); } SwapMeasureCalculations(
      DiscountingSwapTradePricer tradePricer);  static final SwapMeasureCalculations DEFAULT; }### Answer:
@Test public void test_legInitialNotional() { ResolvedSwapLeg firstLeg = SWAP_TRADE.getProduct().getLegs().get(0); ResolvedSwapLeg secondLeg = SWAP_TRADE.getProduct().getLegs().get(1); Currency ccy = firstLeg.getCurrency(); RatePaymentPeriod firstPaymentPeriod = (RatePaymentPeriod) firstLeg.getPaymentPeriods().get(0); double notional = firstPaymentPeriod.getNotional(); LegAmounts expected = LegAmounts.of( SwapLegAmount.of(firstLeg, CurrencyAmount.of(ccy, notional)), SwapLegAmount.of(secondLeg, CurrencyAmount.of(ccy, notional))); assertThat(SwapMeasureCalculations.DEFAULT.legInitialNotional(SWAP_TRADE)).isEqualTo(expected); }
@Test public void test_legInitialNotionalWithoutNotional() { ResolvedSwapTrade trade = ResolvedSwapTrade.builder() .product(ResolvedSwap.of(KNOWN_AMOUNT_SWAP_LEG, KNOWN_AMOUNT_SWAP_LEG)) .build(); assertThatIllegalArgumentException() .isThrownBy(() -> SwapMeasureCalculations.DEFAULT.legInitialNotional(trade)); }