public virtual void test_metadata_dates()
        {
            CdsIsdaCreditCurveNode node     = CdsIsdaCreditCurveNode.ofParSpread(TEMPLATE_NS, QUOTE_ID, LEGAL_ENTITY);
            ParameterMetadata      metadata = node.metadata(END_DATE);

            assertEquals(((LabelDateParameterMetadata)metadata).Date, END_DATE);
        }
        public virtual void test_trade_noMarketData()
        {
            CdsIsdaCreditCurveNode node       = CdsIsdaCreditCurveNode.ofParSpread(TEMPLATE, QUOTE_ID, LEGAL_ENTITY);
            MarketData             marketData = MarketData.empty(VAL_DATE);

            assertThrows(() => node.trade(1d, marketData, REF_DATA), typeof(MarketDataNotFoundException));
        }
        //-------------------------------------------------------------------------
        public virtual void test_metadata_tenor()
        {
            CdsIsdaCreditCurveNode node = CdsIsdaCreditCurveNode.ofQuotedSpread(TEMPLATE, QUOTE_ID, LEGAL_ENTITY, 0.01);
            LocalDate         nodeDate  = LocalDate.of(2015, 1, 22);
            ParameterMetadata metadata  = node.metadata(nodeDate);

            assertEquals(((TenorDateParameterMetadata)metadata).Date, nodeDate);
            assertEquals(((TenorDateParameterMetadata)metadata).Tenor, Tenor.TENOR_10Y);
        }
        public virtual void test_of_pointsUpfront()
        {
            CdsIsdaCreditCurveNode test = CdsIsdaCreditCurveNode.ofPointsUpfront(TEMPLATE, QUOTE_ID, LEGAL_ENTITY, 0.01);

            assertEquals(test.Label, LABEL_AUTO);
            assertEquals(test.LegalEntityId, LEGAL_ENTITY);
            assertEquals(test.ObservableId, QUOTE_ID);
            assertEquals(test.Template, TEMPLATE);
            assertEquals(test.date(VAL_DATE, REF_DATA), date(2025, 6, 20));
        }
        public virtual void test_of_pardSpread()
        {
            CdsIsdaCreditCurveNode test = CdsIsdaCreditCurveNode.ofParSpread(TEMPLATE_NS, QUOTE_ID, LEGAL_ENTITY);

            assertEquals(test.Label, END_DATE.ToString());
            assertEquals(test.LegalEntityId, LEGAL_ENTITY);
            assertEquals(test.ObservableId, QUOTE_ID);
            assertEquals(test.Template, TEMPLATE_NS);
            assertEquals(test.date(VAL_DATE, REF_DATA), END_DATE);
        }
        public virtual void test_builder()
        {
            CdsIsdaCreditCurveNode test = CdsIsdaCreditCurveNode.builder().label(LABEL).template(TEMPLATE).observableId(QUOTE_ID).quoteConvention(CdsQuoteConvention.PAR_SPREAD).legalEntityId(LEGAL_ENTITY).build();

            assertEquals(test.Label, LABEL);
            assertEquals(test.LegalEntityId, LEGAL_ENTITY);
            assertEquals(test.ObservableId, QUOTE_ID);
            assertEquals(test.Template, TEMPLATE);
            assertEquals(test.date(VAL_DATE, REF_DATA), date(2025, 6, 20));
        }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            CdsIsdaCreditCurveNode test1 = CdsIsdaCreditCurveNode.ofQuotedSpread(TEMPLATE, QUOTE_ID, LEGAL_ENTITY, 0.01);

            coverImmutableBean(test1);
            CdsIsdaCreditCurveNode test2 = CdsIsdaCreditCurveNode.ofPointsUpfront(TenorCdsTemplate.of(TENOR_10Y, CdsConventions.EUR_GB_STANDARD), QuoteId.of(StandardId.of("OG-Ticker", "Cds2")), StandardId.of("OG", "DEF"), 0.01);

            QuoteId.of(StandardId.of("OG-Ticker", "Deposit2"));
            coverBeanEquals(test1, test2);
        }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         CdsIsdaCreditCurveNode other = (CdsIsdaCreditCurveNode)obj;
         return(JodaBeanUtils.equal(template, other.template) && JodaBeanUtils.equal(label, other.label) && JodaBeanUtils.equal(observableId, other.observableId) && JodaBeanUtils.equal(legalEntityId, other.legalEntityId) && JodaBeanUtils.equal(quoteConvention, other.quoteConvention) && JodaBeanUtils.equal(fixedRate, other.fixedRate));
     }
     return(false);
 }
        //-------------------------------------------------------------------------
        public virtual void test_trade()
        {
            CdsIsdaCreditCurveNode node    = CdsIsdaCreditCurveNode.ofQuotedSpread(TEMPLATE, QUOTE_ID, LEGAL_ENTITY, 0.01);
            double              rate       = 0.0125;
            double              quantity   = -1234.56;
            MarketData          marketData = ImmutableMarketData.builder(VAL_DATE).addValue(QUOTE_ID, rate).build();
            CdsCalibrationTrade trade      = node.trade(quantity, marketData, REF_DATA);
            CdsTrade            expected   = TEMPLATE.createTrade(LEGAL_ENTITY, VAL_DATE, SELL, -quantity, 0.01, REF_DATA);

            assertEquals(trade.UnderlyingTrade, expected);
            assertEquals(trade.Quote, CdsQuote.of(CdsQuoteConvention.QUOTED_SPREAD, rate));

            CdsIsdaCreditCurveNode node1  = CdsIsdaCreditCurveNode.ofParSpread(TEMPLATE, QUOTE_ID, LEGAL_ENTITY);
            CdsTrade            expected1 = TEMPLATE.createTrade(LEGAL_ENTITY, VAL_DATE, SELL, -quantity, rate, REF_DATA);
            CdsCalibrationTrade trade1    = node1.trade(quantity, marketData, REF_DATA);

            assertEquals(trade1.UnderlyingTrade, expected1);
            assertEquals(trade1.Quote, CdsQuote.of(CdsQuoteConvention.PAR_SPREAD, rate));
        }
        public virtual void test_serialization()
        {
            CdsIsdaCreditCurveNode test = CdsIsdaCreditCurveNode.ofQuotedSpread(TEMPLATE, QUOTE_ID, LEGAL_ENTITY, 0.01);

            assertSerialization(test);
        }
 public virtual void test_build_fail_noRate()
 {
     assertThrows(() => CdsIsdaCreditCurveNode.builder().template(TEMPLATE).observableId(QUOTE_ID).legalEntityId(LEGAL_ENTITY).quoteConvention(CdsQuoteConvention.QUOTED_SPREAD).build(), typeof(System.ArgumentException));
 }