コード例 #1
0
 public virtual void test_map()
 {
     assertEquals(LOOKUP.queryType(), typeof(CreditRatesMarketDataLookup));
     assertEquals(LOOKUP_WITH_SOURCE.requirements(ISSUER_A, USD), FunctionRequirements.builder().observableSource(OBS_SOURCE).valueRequirements(CC_A_USD, DC_USD, RC_A).outputCurrencies(USD).build());
     assertEquals(LOOKUP_WITH_SOURCE.requirements(ISSUER_A, GBP), FunctionRequirements.builder().observableSource(OBS_SOURCE).valueRequirements(CC_A_GBP, DC_GBP, RC_A).outputCurrencies(GBP).build());
     assertEquals(LOOKUP_WITH_SOURCE.requirements(ISSUER_B, GBP), FunctionRequirements.builder().observableSource(OBS_SOURCE).valueRequirements(CC_B_GBP, DC_GBP, RC_B).outputCurrencies(GBP).build());
     assertEquals(LOOKUP.requirements(ISSUER_A, USD), FunctionRequirements.builder().valueRequirements(CC_A_USD, DC_USD, RC_A).outputCurrencies(USD).build());
     assertEquals(LOOKUP.requirements(ISSUER_A, GBP), FunctionRequirements.builder().valueRequirements(CC_A_GBP, DC_GBP, RC_A).outputCurrencies(GBP).build());
     assertEquals(LOOKUP.requirements(ISSUER_B, GBP), FunctionRequirements.builder().valueRequirements(CC_B_GBP, DC_GBP, RC_B).outputCurrencies(GBP).build());
     assertThrowsIllegalArg(() => LOOKUP.requirements(ISSUER_A, EUR));
     assertThrowsIllegalArg(() => LOOKUP.requirements(ISSUER_C, USD));
     assertEquals(LOOKUP.creditRatesProvider(MOCK_MARKET_DATA), DefaultLookupCreditRatesProvider.of((DefaultCreditRatesMarketDataLookup)LOOKUP, MOCK_MARKET_DATA));
 }
 //-----------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         DefaultLookupCreditRatesProvider other = (DefaultLookupCreditRatesProvider)obj;
         return(JodaBeanUtils.equal(lookup, other.lookup) && JodaBeanUtils.equal(marketData, other.marketData));
     }
     return(false);
 }
コード例 #3
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            coverImmutableBean((ImmutableBean)LOOKUP_WITH_SOURCE);
            ImmutableMap <Pair <StandardId, Currency>, CurveId> ccMap = ImmutableMap.of(Pair.of(ISSUER_A, USD), CC_A_USD);
            ImmutableMap <Currency, CurveId>   dcMap = ImmutableMap.of(USD, DC_USD);
            ImmutableMap <StandardId, CurveId> rcMap = ImmutableMap.of(ISSUER_A, RC_A);
            CreditRatesMarketDataLookup        test2 = CreditRatesMarketDataLookup.of(ccMap, dcMap, rcMap);

            coverBeanEquals((ImmutableBean)LOOKUP_WITH_SOURCE, (ImmutableBean)test2);

            // related coverage
            coverImmutableBean((ImmutableBean)LOOKUP_WITH_SOURCE.marketDataView(MOCK_CALC_MARKET_DATA));
            DefaultCreditRatesScenarioMarketData.meta();
            coverImmutableBean((ImmutableBean)LOOKUP_WITH_SOURCE.marketDataView(MOCK_MARKET_DATA));
            DefaultCreditRatesMarketData.meta();
            coverImmutableBean((ImmutableBean)LOOKUP_WITH_SOURCE.marketDataView(MOCK_MARKET_DATA).creditRatesProvider());
            DefaultLookupCreditRatesProvider.meta();
        }
 //-------------------------------------------------------------------------
 public CreditRatesProvider creditRatesProvider(MarketData marketData)
 {
     return(DefaultLookupCreditRatesProvider.of(this, marketData));
 }