//------------------------------------------------------------------------- public FunctionRequirements requirements(SecurityId securityId, LegalEntityId issuerId, Currency currency) { // repo RepoGroup repoKey = repoCurveSecurityGroups.get(securityId); if (repoKey == null) { repoKey = repoCurveGroups.get(issuerId); } if (repoKey == null) { throw new System.ArgumentException(Messages.format("Legal entity discounting lookup has no repo curve defined for '{}' and '{}'", securityId, issuerId)); } CurveId repoCurveId = repoCurves.get(Pair.of(repoKey, currency)); if (repoCurveId == null) { throw new System.ArgumentException(Messages.format("Legal entity discounting lookup has no repo curve defined for '{}' and '{}'", securityId, issuerId)); } // issuer LegalEntityGroup issuerKey = issuerCurveGroups.get(issuerId); if (issuerKey == null) { throw new System.ArgumentException(Messages.format("Legal entity discounting lookup has no issuer curve defined for '{}'", issuerId)); } CurveId issuerCurveId = issuerCurves.get(Pair.of(issuerKey, currency)); if (issuerCurveId == null) { throw new System.ArgumentException(Messages.format("Legal entity discounting lookup has no issuer curve defined for '{}'", issuerId)); } // result return(FunctionRequirements.builder().valueRequirements(ImmutableSet.of(repoCurveId, issuerCurveId)).outputCurrencies(currency).observableSource(observableSource).build()); }
//------------------------------------------------------------------------- //JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the Java 'super' constraint: //ORIGINAL LINE: @Override public <T extends com.opengamma.strata.basics.CalculationTarget> CalculationFunction<? super T> getFunction(T target) //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: public override CalculationFunction <object> getFunction <T>(T target) where T : com.opengamma.strata.basics.CalculationTarget { //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") CalculationFunction<? super T> function = (CalculationFunction<? super T>) functions.get(target.getClass()); //JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the Java 'super' constraint: //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: CalculationFunction <object> function = (CalculationFunction <object>)functions.get(target.GetType()); return(function != null ? function : MissingConfigCalculationFunction.INSTANCE); }
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: @Override public com.google.common.collect.ImmutableSet<com.opengamma.strata.data.MarketDataId<?>> getVolatilityIds(com.opengamma.strata.basics.index.IborIndex index) public ImmutableSet <MarketDataId <object> > getVolatilityIds(IborIndex index) { SwaptionVolatilitiesId id = volatilityIds.get(index); if (id == null) { throw new System.ArgumentException(msgIndexNotFound(index)); } return(ImmutableSet.of(id)); }
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: @Override public com.google.common.collect.ImmutableSet<com.opengamma.strata.data.MarketDataId<?>> getVolatilityIds(com.opengamma.strata.product.SecurityId securityId) public ImmutableSet <MarketDataId <object> > getVolatilityIds(SecurityId securityId) { BondFutureVolatilitiesId id = volatilityIds.get(securityId); if (id == null) { throw new System.ArgumentException(msgSecurityNotFound(securityId)); } return(ImmutableSet.of(id)); }
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: @Override public com.google.common.collect.ImmutableSet<com.opengamma.strata.data.MarketDataId<?>> getVolatilityIds(com.opengamma.strata.basics.currency.CurrencyPair currencyPair) public ImmutableSet <MarketDataId <object> > getVolatilityIds(CurrencyPair currencyPair) { FxOptionVolatilitiesId id = volatilityIds.get(currencyPair); if (id == null) { throw new System.ArgumentException(msgPairNotFound(currencyPair)); } return(ImmutableSet.of(id)); }
/// <summary> /// Gets an attribute by name, throwing an exception if not found. /// <para> /// This returns the value of the attribute with the specified name. /// An exception is thrown if the attribute does not exist. /// /// </para> /// </summary> /// <param name="attrName"> the attribute name to find </param> /// <returns> the attribute value </returns> /// <exception cref="IllegalArgumentException"> if the attribute name does not exist </exception> public string getAttribute(string attrName) { string attrValue = attributes.get(attrName); if (string.ReferenceEquals(attrValue, null)) { throw new System.ArgumentException(Messages.format("Unknown attribute '{}' on element '{}'", attrName, name)); } return(attrValue); }
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: @Override public com.google.common.collect.ImmutableSet<com.opengamma.strata.data.MarketDataId<?>> getForwardMarketDataIds(com.opengamma.strata.basics.index.Index index) public ImmutableSet <MarketDataId <object> > getForwardMarketDataIds(Index index) { CurveId id = forwardCurves.get(index); if (id == null) { throw new System.ArgumentException(msgIndexNotFound(index)); } return(ImmutableSet.of(id)); }
//------------------------------------------------------------------------- public virtual void test_defaultByCurrency_valid() { lock (this) { ImmutableMap <Currency, HolidayCalendarId> test = HolidayCalendarIniLookup.loadDefaultsFromIni("HolidayCalendarDefaultDataValid.ini"); assertEquals(test.size(), 2); assertEquals(test.get(Currency.GBP), HolidayCalendarIds.GBLO); assertEquals(test.get(Currency.USD), HolidayCalendarIds.NYSE); } }
//------------------------------------------------------------------------- public override T getInfo <T>(SurfaceInfoType <T> type) { //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") T value = (T) info.get(type); T value = (T)info.get(type); if (value == null) { throw new System.ArgumentException(Messages.format("Surface info not found for type '{}'", type)); } return(value); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") @Override public <T> MarketDataBox<T> getValue(com.opengamma.strata.data.MarketDataId<T> id) public override MarketDataBox <T> getValue <T>(MarketDataId <T> id) { //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") MarketDataBox<T> value = (MarketDataBox<T>) values.get(id); MarketDataBox <T> value = (MarketDataBox <T>)values.get(id); if (value == null) { throw new MarketDataNotFoundException(msgValueNotFound(id)); } return(value); }
private CurrencyParameterSensitivities sensitivityCreidtCurve <T>(ImmutableCreditRatesProvider provider, System.Func <ImmutableCreditRatesProvider, CurrencyAmount> valueFn, MetaProperty <ImmutableMap <T, LegalEntitySurvivalProbabilities> > metaProperty, CurrencyAmount valueInit) { ImmutableMap <T, LegalEntitySurvivalProbabilities> baseCurves = metaProperty.get(provider); CurrencyParameterSensitivities result = CurrencyParameterSensitivities.empty(); foreach (T key in baseCurves.Keys) { LegalEntitySurvivalProbabilities credit = baseCurves.get(key); CreditDiscountFactors creditDiscountFactors = credit.SurvivalProbabilities; DiscountFactors discountFactors = creditDiscountFactors.toDiscountFactors(); Curve curve = checkDiscountFactors(discountFactors); int paramCount = curve.ParameterCount; double[] sensitivity = new double[paramCount]; for (int i = 0; i < paramCount; i++) { Curve dscBumped = curve.withParameter(i, curve.getParameter(i) + shift); IDictionary <T, LegalEntitySurvivalProbabilities> mapBumped = new Dictionary <T, LegalEntitySurvivalProbabilities>(baseCurves); mapBumped[key] = LegalEntitySurvivalProbabilities.of(credit.LegalEntityId, createCreditDiscountFactors(creditDiscountFactors, dscBumped)); ImmutableCreditRatesProvider providerDscBumped = provider.toBuilder().set(metaProperty, mapBumped).build(); sensitivity[i] = (valueFn(providerDscBumped).Amount - valueInit.Amount) / shift; } result = result.combinedWith(curve.createParameterSensitivity(valueInit.Currency, DoubleArray.copyOf(sensitivity))); } return(result); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") @Override public <T> com.opengamma.strata.data.scenario.MarketDataBox<T> getValue(com.opengamma.strata.data.MarketDataId<T> id) public override MarketDataBox <T> getValue <T>(MarketDataId <T> id) { // this code exists to ensure that the error messages from market data building // are exposed to users when the failures are not checked // a special case for FX rates containing the same currency twice if (id is FxRateId && ((FxRateId)id).Pair.Identity) { FxRateId fxRateId = (FxRateId)id; FxRate identityRate = FxRate.of(fxRateId.Pair, 1); return(MarketDataBox.ofSingleValue((T)identityRate)); } // find the data and check it against the failures Optional <MarketDataBox <T> > opt = underlying.findValue(id); if (!opt.Present) { Failure failure = valueFailures.get(id); if (failure != null) { throw new FailureException(failure); } throw new MarketDataNotFoundException(Messages.format("Market data not found for identifier '{}' of type '{}'", id, id.GetType().Name)); } return(opt.get()); }
/// <summary> /// Gets a single section of this INI file. /// <para> /// This returns the section associated with the specified name. /// If the section does not exist an exception is thrown. /// /// </para> /// </summary> /// <param name="name"> the section name </param> /// <returns> the INI file section </returns> /// <exception cref="IllegalArgumentException"> if the section does not exist </exception> public PropertySet section(string name) { ArgChecker.notNull(name, "name"); if (contains(name) == false) { throw new System.ArgumentException("Unknown INI file section: " + name); } return(sectionMap.get(name)); }
// finds a default internal HolidayCalendarId defaultByCurrency(Currency currency) { HolidayCalendarId calId = BY_CURRENCY.get(currency); if (calId == null) { throw new System.ArgumentException("No default Holiday Calendar for currency " + currency); } return(calId); }
// calculate one measure //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: private com.opengamma.strata.collect.result.Result<?> calculate(com.opengamma.strata.calc.Measure measure, com.opengamma.strata.product.capfloor.ResolvedIborCapFloorTrade trade, com.opengamma.strata.measure.rate.RatesScenarioMarketData ratesMarketData, IborCapFloorScenarioMarketData capFloorMarketData) private Result <object> calculate(Measure measure, ResolvedIborCapFloorTrade trade, RatesScenarioMarketData ratesMarketData, IborCapFloorScenarioMarketData capFloorMarketData) { SingleMeasureCalculation calculator = CALCULATORS.get(measure); if (calculator == null) { return(Result.failure(FailureReason.UNSUPPORTED, "Unsupported measure for IborCapFloorTrade: {}", measure)); } return(Result.of(() => calculator(trade, ratesMarketData, capFloorMarketData))); }
// calculate one measure //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: private com.opengamma.strata.collect.result.Result<?> calculate(com.opengamma.strata.calc.Measure measure, com.opengamma.strata.product.cms.ResolvedCmsTrade trade, CmsMeasureCalculations calculations, com.opengamma.strata.measure.rate.RatesScenarioMarketData ratesMarketData, com.opengamma.strata.measure.swaption.SwaptionScenarioMarketData swaptionMarketData) private Result <object> calculate(Measure measure, ResolvedCmsTrade trade, CmsMeasureCalculations calculations, RatesScenarioMarketData ratesMarketData, SwaptionScenarioMarketData swaptionMarketData) { SingleMeasureCalculation calculator = CALCULATORS.get(measure); if (calculator == null) { return(Result.failure(FailureReason.UNSUPPORTED, "Unsupported measure for SwaptionTrade: {}", measure)); } return(Result.of(() => calculator(calculations, trade, ratesMarketData, swaptionMarketData))); }
// finds the index curve private Curve indexCurve(Index index) { Curve curve = indexCurves.get(index); if (curve == null) { throw new System.ArgumentException("Unable to find index curve: " + index); } return(curve); }
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: @Override public com.google.common.collect.ImmutableSet<com.opengamma.strata.data.MarketDataId<?>> getDiscountMarketDataIds(com.opengamma.strata.basics.currency.Currency currency) public ImmutableSet <MarketDataId <object> > getDiscountMarketDataIds(Currency currency) { CurveId id = discountCurves.get(currency); if (id == null) { throw new System.ArgumentException(msgCurrencyNotFound(currency)); } return(ImmutableSet.of(id)); }
// calculate one measure //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: private com.opengamma.strata.collect.result.Result<?> calculate(com.opengamma.strata.calc.Measure measure, com.opengamma.strata.product.bond.ResolvedCapitalIndexedBondTrade resolved, com.opengamma.strata.measure.rate.RatesScenarioMarketData ratesMarketData, LegalEntityDiscountingScenarioMarketData legalEntityMarketData) private Result <object> calculate(Measure measure, ResolvedCapitalIndexedBondTrade resolved, RatesScenarioMarketData ratesMarketData, LegalEntityDiscountingScenarioMarketData legalEntityMarketData) { SingleMeasureCalculation calculator = CALCULATORS.get(measure); if (calculator == null) { return(Result.failure(FailureReason.UNSUPPORTED, "Unsupported measure for CapitalIndexedBond: {}", measure)); } return(Result.of(() => calculator(resolved, ratesMarketData, legalEntityMarketData))); }
// calculate one measure //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: private com.opengamma.strata.collect.result.Result<?> calculate(com.opengamma.strata.calc.Measure measure, com.opengamma.strata.product.GenericSecurityPosition position, com.opengamma.strata.data.scenario.ScenarioMarketData scenarioMarketData) private Result <object> calculate(Measure measure, GenericSecurityPosition position, ScenarioMarketData scenarioMarketData) { SingleMeasureCalculation calculator = CALCULATORS.get(measure); if (calculator == null) { return(Result.failure(FailureReason.UNSUPPORTED, "Unsupported measure for GenericSecurityPosition: {}", measure)); } return(Result.of(() => calculator(position.Security, position.Quantity, scenarioMarketData))); }
//------------------------------------------------------------------------- public DiscountFactors discountFactors(Currency currency) { Curve curve = discountCurves.get(currency); if (curve == null) { throw new System.ArgumentException("Unable to find discount curve: " + currency); } return(DiscountFactors.of(currency, valuationDate, curve)); }
// calculate one measure //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: private com.opengamma.strata.collect.result.Result<?> calculate(com.opengamma.strata.calc.Measure measure, com.opengamma.strata.product.bond.ResolvedBillTrade resolved, LegalEntityDiscountingScenarioMarketData marketData) private Result <object> calculate(Measure measure, ResolvedBillTrade resolved, LegalEntityDiscountingScenarioMarketData marketData) { SingleMeasureCalculation calculator = CALCULATORS.get(measure); if (calculator == null) { return(Result.failure(FailureReason.UNSUPPORTED, "Unsupported measure for Bill: {}", measure)); } return(Result.of(() => calculator(resolved, marketData))); }
// calculate one measure //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: private com.opengamma.strata.collect.result.Result<?> calculate(com.opengamma.strata.calc.Measure measure, com.opengamma.strata.product.fxopt.ResolvedFxSingleBarrierOptionTrade trade, com.opengamma.strata.measure.rate.RatesScenarioMarketData ratesMarketData, FxOptionScenarioMarketData optionMarketData, FxSingleBarrierOptionMethod method) private Result <object> calculate(Measure measure, ResolvedFxSingleBarrierOptionTrade trade, RatesScenarioMarketData ratesMarketData, FxOptionScenarioMarketData optionMarketData, FxSingleBarrierOptionMethod method) { SingleMeasureCalculation calculator = CALCULATORS.get(measure); if (calculator == null) { return(Result.failure(FailureReason.UNSUPPORTED, "Unsupported measure for FxSingleBarrierOptionTrade: {}", measure)); } return(Result.of(() => calculator(trade, ratesMarketData, optionMarketData, method))); }
// calculate one measure //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: private com.opengamma.strata.collect.result.Result<?> calculate(com.opengamma.strata.calc.Measure measure, com.opengamma.strata.product.index.ResolvedIborFutureTrade resolved, com.opengamma.strata.measure.rate.RatesScenarioMarketData marketData) private Result <object> calculate(Measure measure, ResolvedIborFutureTrade resolved, RatesScenarioMarketData marketData) { SingleMeasureCalculation calculator = CALCULATORS.get(measure); if (calculator == null) { return(Result.failure(FailureReason.UNSUPPORTED, "Unsupported measure for IborFuture: {}", measure)); } return(Result.of(() => calculator(resolved, marketData))); }
// calculate one measure //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: private com.opengamma.strata.collect.result.Result<?> calculate(com.opengamma.strata.calc.Measure measure, com.opengamma.strata.product.SecurityTrade trade, com.opengamma.strata.product.Security security, com.opengamma.strata.data.scenario.ScenarioMarketData scenarioMarketData) private Result <object> calculate(Measure measure, SecurityTrade trade, Security security, ScenarioMarketData scenarioMarketData) { SingleMeasureCalculation calculator = CALCULATORS.get(measure); if (calculator == null) { return(Result.failure(FailureReason.UNSUPPORTED, "Unsupported measure for SecurityTrade: {}", measure)); } return(Result.of(() => calculator(security, trade.Quantity, scenarioMarketData))); }
// calculate one measure //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: private com.opengamma.strata.collect.result.Result<?> calculate(com.opengamma.strata.calc.Measure measure, com.opengamma.strata.product.credit.ResolvedCdsIndexTrade trade, CreditRatesScenarioMarketData marketData, com.opengamma.strata.basics.ReferenceData refData) private Result <object> calculate(Measure measure, ResolvedCdsIndexTrade trade, CreditRatesScenarioMarketData marketData, ReferenceData refData) { SingleMeasureCalculation calculator = CALCULATORS.get(measure); if (calculator == null) { return(Result.failure(FailureReason.UNSUPPORTED, "Unsupported measure for CdsIndexTrade: {}", measure)); } return(Result.of(() => calculator(trade, marketData, refData))); }
//------------------------------------------------------------------------- /// <summary> /// Looks up an element by href/id reference. /// </summary> /// <param name="hrefEl"> the element containing the href/id </param> /// <returns> the matched element </returns> /// <exception cref="FpmlParseException"> if the reference is not found </exception> // lookup an element via href/id reference public XmlElement lookupReference(XmlElement hrefEl) { string hrefId = hrefEl.getAttribute(HREF); XmlElement el = references.get(hrefId); if (el == null) { throw new FpmlParseException(Messages.format("Document reference not found: href='{}'", hrefId)); } return(el); }
//------------------------------------------------------------------------- /// <summary> /// Obtains an instance for the specified ISO-4217 three letter currency code. /// <para> /// A currency is uniquely identified by ISO-4217 three letter code. /// Currencies should be defined in configuration before they can be used. /// If the requested currency is not defined in configuration, it will still be created, /// however it will have the default value of zero for the minor units and 'USD' for /// the triangulation currency. /// /// </para> /// </summary> /// <param name="currencyCode"> the three letter currency code, ASCII and upper case </param> /// <returns> the singleton instance </returns> /// <exception cref="IllegalArgumentException"> if the currency code is invalid </exception> //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @FromString public static Currency of(String currencyCode) public static Currency of(string currencyCode) { ArgChecker.notNull(currencyCode, "currencyCode"); Currency currency = CONFIGURED.get(currencyCode); if (currency == null) { return(addCode(currencyCode)); } return(currency); }
// jacobian indirect, merging groups private static DoubleMatrix jacobianIndirect(DoubleMatrix res, DoubleMatrix pDmCurrentMatrix, int nbTrades, int totalParamsGroup, int totalParamsPrevious, ImmutableList <CurveParameterSize> orderPrevious, ImmutableMap <CurveName, JacobianCalibrationMatrix> jacobiansPrevious) { if (totalParamsPrevious == 0) { return(DoubleMatrix.EMPTY); } //JAVA TO C# CONVERTER NOTE: The following call to the 'RectangularArrays' helper class reproduces the rectangular array initialization that is automatic in Java: //ORIGINAL LINE: double[][] nonDirect = new double[totalParamsGroup][totalParamsPrevious]; double[][] nonDirect = RectangularArrays.ReturnRectangularDoubleArray(totalParamsGroup, totalParamsPrevious); for (int i = 0; i < nbTrades; i++) { Array.Copy(res.rowArray(i), 0, nonDirect[i], 0, totalParamsPrevious); } DoubleMatrix pDpPreviousMatrix = (DoubleMatrix)MATRIX_ALGEBRA.scale(MATRIX_ALGEBRA.multiply(pDmCurrentMatrix, DoubleMatrix.copyOf(nonDirect)), -1d); // all curves: order and size int[] startIndexBefore = new int[orderPrevious.size()]; for (int i = 1; i < orderPrevious.size(); i++) { startIndexBefore[i] = startIndexBefore[i - 1] + orderPrevious.get(i - 1).ParameterCount; } // transition Matrix: all curves from previous groups //JAVA TO C# CONVERTER NOTE: The following call to the 'RectangularArrays' helper class reproduces the rectangular array initialization that is automatic in Java: //ORIGINAL LINE: double[][] transition = new double[totalParamsPrevious][totalParamsPrevious]; double[][] transition = RectangularArrays.ReturnRectangularDoubleArray(totalParamsPrevious, totalParamsPrevious); for (int i = 0; i < orderPrevious.size(); i++) { int paramCountOuter = orderPrevious.get(i).ParameterCount; JacobianCalibrationMatrix thisInfo = jacobiansPrevious.get(orderPrevious.get(i).Name); DoubleMatrix thisMatrix = thisInfo.JacobianMatrix; int startIndexInner = 0; for (int j = 0; j < orderPrevious.size(); j++) { int paramCountInner = orderPrevious.get(j).ParameterCount; if (thisInfo.containsCurve(orderPrevious.get(j).Name)) { // If not, the matrix stay with 0 for (int k = 0; k < paramCountOuter; k++) { Array.Copy(thisMatrix.rowArray(k), startIndexInner, transition[startIndexBefore[i] + k], startIndexBefore[j], paramCountInner); } } startIndexInner += paramCountInner; } } DoubleMatrix transitionMatrix = DoubleMatrix.copyOf(transition); return((DoubleMatrix)MATRIX_ALGEBRA.multiply(pDpPreviousMatrix, transitionMatrix)); }
public virtual void test_valid2() { ImmutableMap <string, HolidayCalendar> lookup = HolidayCalendarIniLookup.loadFromIni("HolidayCalendarDataValid2.ini"); assertEquals(lookup.size(), 1); HolidayCalendar test = lookup.get("TEST-VALID"); assertTrue(test.isHoliday(date(2015, 1, 1))); assertTrue(test.isHoliday(date(2015, 1, 6))); assertTrue(test.isHoliday(date(2015, 4, 5))); assertTrue(test.isHoliday(date(2015, 12, 25))); assertTrue(test.isHoliday(date(2016, 1, 1))); assertEquals(test.Name, "TEST-VALID"); assertEquals(test.ToString(), "HolidayCalendar[TEST-VALID]"); }