//------------------------------------------------------------------------- public virtual void coverage() { ImmutableMap <SecurityId, RepoGroup> repoSecurityGroups = ImmutableMap.of(SEC_A1, GROUP_REPO_X); ImmutableMap <LegalEntityId, RepoGroup> repoGroups = ImmutableMap.of(ISSUER_A, GROUP_REPO_Y, ISSUER_B, GROUP_REPO_Y); ImmutableMap <Pair <RepoGroup, Currency>, CurveId> repoCurves = ImmutableMap.of(Pair.of(GROUP_REPO_X, USD), CURVE_ID_USD1, Pair.of(GROUP_REPO_Y, USD), CURVE_ID_USD2, Pair.of(GROUP_REPO_Y, GBP), CURVE_ID_GBP1); ImmutableMap <LegalEntityId, LegalEntityGroup> issuerGroups = ImmutableMap.of(ISSUER_A, GROUP_ISSUER_M, ISSUER_B, GROUP_ISSUER_N); ImmutableMap <Pair <LegalEntityGroup, Currency>, CurveId> issuerCurves = ImmutableMap.of(Pair.of(GROUP_ISSUER_M, USD), CURVE_ID_USD3, Pair.of(GROUP_ISSUER_N, USD), CURVE_ID_USD4, Pair.of(GROUP_ISSUER_N, GBP), CURVE_ID_GBP2); LegalEntityDiscountingMarketDataLookup test = LegalEntityDiscountingMarketDataLookup.of(repoSecurityGroups, repoGroups, repoCurves, issuerGroups, issuerCurves); coverImmutableBean((ImmutableBean)test); ImmutableMap <LegalEntityId, RepoGroup> repoGroups2 = ImmutableMap.of(); ImmutableMap <Pair <RepoGroup, Currency>, CurveId> repoCurves2 = ImmutableMap.of(); ImmutableMap <LegalEntityId, LegalEntityGroup> issuerGroups2 = ImmutableMap.of(); ImmutableMap <Pair <LegalEntityGroup, Currency>, CurveId> issuerCurves2 = ImmutableMap.of(); LegalEntityDiscountingMarketDataLookup test2 = LegalEntityDiscountingMarketDataLookup.of(repoGroups2, repoCurves2, issuerGroups2, issuerCurves2, OBS_SOURCE); coverBeanEquals((ImmutableBean)test, (ImmutableBean)test2); // related coverage coverImmutableBean((ImmutableBean)test.marketDataView(MOCK_CALC_MARKET_DATA)); DefaultLegalEntityDiscountingScenarioMarketData.meta(); coverImmutableBean((ImmutableBean)test.marketDataView(MOCK_MARKET_DATA)); DefaultLegalEntityDiscountingMarketData.meta(); coverImmutableBean((ImmutableBean)test.marketDataView(MOCK_MARKET_DATA).discountingProvider()); DefaultLookupLegalEntityDiscountingProvider.meta(); }
//------------------------------------------------------------------------- public virtual void test_of_map() { ImmutableMap <SecurityId, RepoGroup> repoSecurityGroups = ImmutableMap.of(SEC_A1, GROUP_REPO_X); ImmutableMap <LegalEntityId, RepoGroup> repoGroups = ImmutableMap.of(ISSUER_A, GROUP_REPO_Y, ISSUER_B, GROUP_REPO_Y, ISSUER_C, GROUP_REPO_Y, ISSUER_D, GROUP_REPO_Y); ImmutableMap <Pair <RepoGroup, Currency>, CurveId> repoCurves = ImmutableMap.of(Pair.of(GROUP_REPO_X, USD), CURVE_ID_USD1, Pair.of(GROUP_REPO_Y, USD), CURVE_ID_USD2, Pair.of(GROUP_REPO_Y, GBP), CURVE_ID_GBP1); ImmutableMap <LegalEntityId, LegalEntityGroup> issuerGroups = ImmutableMap.of(ISSUER_A, GROUP_ISSUER_M, ISSUER_B, GROUP_ISSUER_N, ISSUER_C, GROUP_ISSUER_M); ImmutableMap <Pair <LegalEntityGroup, Currency>, CurveId> issuerCurves = ImmutableMap.of(Pair.of(GROUP_ISSUER_M, USD), CURVE_ID_USD3, Pair.of(GROUP_ISSUER_N, USD), CURVE_ID_USD4, Pair.of(GROUP_ISSUER_N, GBP), CURVE_ID_GBP2); LegalEntityDiscountingMarketDataLookup test = LegalEntityDiscountingMarketDataLookup.of(repoSecurityGroups, repoGroups, repoCurves, issuerGroups, issuerCurves); assertEquals(test.queryType(), typeof(LegalEntityDiscountingMarketDataLookup)); assertEquals(test.requirements(SEC_A1, ISSUER_A, USD), FunctionRequirements.builder().valueRequirements(CURVE_ID_USD1, CURVE_ID_USD3).outputCurrencies(USD).build()); assertEquals(test.requirements(SEC_A2, ISSUER_A, USD), FunctionRequirements.builder().valueRequirements(CURVE_ID_USD2, CURVE_ID_USD3).outputCurrencies(USD).build()); assertEquals(test.requirements(SEC_B1, ISSUER_B, USD), FunctionRequirements.builder().valueRequirements(CURVE_ID_USD2, CURVE_ID_USD4).outputCurrencies(USD).build()); assertEquals(test.requirements(SEC_B1, ISSUER_B, GBP), FunctionRequirements.builder().valueRequirements(CURVE_ID_GBP1, CURVE_ID_GBP2).outputCurrencies(GBP).build()); assertThrowsIllegalArg(() => test.requirements(SEC_B1, LegalEntityId.of("XXX", "XXX"), GBP)); assertThrowsIllegalArg(() => test.requirements(SecurityId.of("XXX", "XXX"), LegalEntityId.of("XXX", "XXX"), GBP)); assertThrowsIllegalArg(() => test.requirements(SEC_A1, ISSUER_A, GBP)); assertThrowsIllegalArg(() => test.requirements(SEC_C1, ISSUER_C, GBP)); assertThrowsIllegalArg(() => test.requirements(SEC_D1, ISSUER_D, GBP)); assertEquals(test.discountingProvider(MOCK_MARKET_DATA), DefaultLookupLegalEntityDiscountingProvider.of((DefaultLegalEntityDiscountingMarketDataLookup)test, MOCK_MARKET_DATA)); }
//----------------------------------------------------------------------- public override bool Equals(object obj) { if (obj == this) { return(true); } if (obj != null && obj.GetType() == this.GetType()) { DefaultLookupLegalEntityDiscountingProvider other = (DefaultLookupLegalEntityDiscountingProvider)obj; return(JodaBeanUtils.equal(lookup, other.lookup) && JodaBeanUtils.equal(marketData, other.marketData)); } return(false); }
//------------------------------------------------------------------------- public LegalEntityDiscountingProvider discountingProvider(MarketData marketData) { return(DefaultLookupLegalEntityDiscountingProvider.of(this, marketData)); }