public virtual void test_withUnknownFailure() { BuiltScenarioMarketData smd = BuiltScenarioMarketData.builder(MarketDataBox.ofSingleValue(VAL_DATE)).build(); BuiltMarketData test = new BuiltMarketData(smd); assertEquals(test.ValuationDate, VAL_DATE); assertEquals(test.containsValue(ID), false); assertEquals(test.Ids, ImmutableSet.of()); assertEquals(test.findValue(ID), null); assertThrows(() => test.getValue(ID), typeof(MarketDataNotFoundException)); }
//------------------------------------------------------------------------- public virtual void test_withKnownFailure() { string failureMessage = "Something went wrong"; BuiltScenarioMarketData smd = BuiltScenarioMarketData.builder(MarketDataBox.ofSingleValue(VAL_DATE)).addResult(ID, Result.failure(FailureReason.ERROR, failureMessage)).build(); BuiltMarketData test = new BuiltMarketData(smd); assertEquals(test.ValuationDate, VAL_DATE); assertEquals(test.containsValue(ID), false); assertEquals(test.Ids, ImmutableSet.of()); assertEquals(test.findValue(ID), null); assertThrows(() => test.getValue(ID), typeof(FailureException), failureMessage); }