Ejemplo n.º 1
0
        //-------------------------------------------------------------------------
        public virtual void test_collectIndices_simple()
        {
            KnownAmountRateComputation test = KnownAmountRateComputation.of(GBP_P1000);

            ImmutableSet.Builder <Index> builder = ImmutableSet.builder();
            test.collectIndices(builder);
            assertEquals(builder.build(), ImmutableSet.of());
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            KnownAmountRateComputation test = KnownAmountRateComputation.of(GBP_P1000);

            coverImmutableBean(test);
            KnownAmountRateComputation test2 = KnownAmountRateComputation.of(GBP_P1000.plus(100));

            coverBeanEquals(test, test2);
        }
Ejemplo n.º 3
0
 //-----------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         KnownAmountRateComputation other = (KnownAmountRateComputation)obj;
         return(JodaBeanUtils.equal(amount, other.amount));
     }
     return(false);
 }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates the {@code RateComputation} for the stub.
 /// </summary>
 /// <param name="defaultRate">  the default fixed rate </param>
 /// <returns> the rate computation </returns>
 internal RateComputation createRateComputation(double defaultRate)
 {
     if (FixedRate)
     {
         return(FixedRateComputation.of(fixedRate.Value));
     }
     else if (KnownAmount)
     {
         return(KnownAmountRateComputation.of(knownAmount));
     }
     else
     {
         return(FixedRateComputation.of(defaultRate));
     }
 }
Ejemplo n.º 5
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates the {@code RateComputation} for the stub.
 /// </summary>
 /// <param name="fixingDate">  the fixing date </param>
 /// <param name="defaultIndex">  the default index to use if the stub has no rules </param>
 /// <param name="refData">  the reference data </param>
 /// <returns> the rate observation </returns>
 internal RateComputation createRateComputation(LocalDate fixingDate, IborIndex defaultIndex, ReferenceData refData)
 {
     if (Interpolated)
     {
         return(IborInterpolatedRateComputation.of(index, indexInterpolated, fixingDate, refData));
     }
     else if (FloatingRate)
     {
         return(IborRateComputation.of(index, fixingDate, refData));
     }
     else if (FixedRate)
     {
         return(FixedRateComputation.of(fixedRate.Value));
     }
     else if (KnownAmount)
     {
         return(KnownAmountRateComputation.of(knownAmount));
     }
     else
     {
         return(IborRateComputation.of(defaultIndex, fixingDate, refData));
     }
 }
        public virtual void test_createRateComputation_knownAmount()
        {
            IborRateStubCalculation test = IborRateStubCalculation.ofKnownAmount(GBP_P1000);

            assertEquals(test.createRateComputation(DATE, GBP_LIBOR_3M, REF_DATA), KnownAmountRateComputation.of(GBP_P1000));
        }
        public virtual void test_createRateComputation_knownAmount()
        {
            FixedRateStubCalculation test = FixedRateStubCalculation.ofKnownAmount(GBP_P1000);

            assertEquals(test.createRateComputation(3d), KnownAmountRateComputation.of(GBP_P1000));
        }
Ejemplo n.º 8
0
        public virtual void test_serialization()
        {
            KnownAmountRateComputation test = KnownAmountRateComputation.of(GBP_P1000);

            assertSerialization(test);
        }
Ejemplo n.º 9
0
        //-------------------------------------------------------------------------
        public virtual void test_of()
        {
            KnownAmountRateComputation test = KnownAmountRateComputation.of(GBP_P1000);

            assertEquals(test.Amount, GBP_P1000);
        }