//------------------------------------------------------------------------- public virtual void test_summarize() { CapitalIndexedBondPosition trade = sut(); PortfolioItemSummary expected = PortfolioItemSummary.builder().id(POSITION_INFO.Id.orElse(null)).portfolioItemType(PortfolioItemType.POSITION).productType(ProductType.BOND).currencies(Currency.USD).description("Bond x 10").build(); assertEquals(trade.summarize(), expected); }
//------------------------------------------------------------------------- public virtual void test_withQuantity() { CapitalIndexedBondPosition @base = sut(); double quantity = 75343d; CapitalIndexedBondPosition computed = @base.withQuantity(quantity); CapitalIndexedBondPosition expected = CapitalIndexedBondPosition.builder().info(POSITION_INFO).product(PRODUCT).longQuantity(quantity).build(); assertEquals(computed, expected); }
//------------------------------------------------------------------------- public virtual void test_builder_resolved() { CapitalIndexedBondPosition test = sut(); assertEquals(test.Product, PRODUCT); assertEquals(test.Info, POSITION_INFO); assertEquals(test.LongQuantity, QUANTITY, 0d); assertEquals(test.ShortQuantity, 0d, 0d); assertEquals(test.Quantity, QUANTITY, 0d); assertEquals(test.withInfo(POSITION_INFO).Info, POSITION_INFO); assertEquals(test.withQuantity(129).Quantity, 129d, 0d); }
public override bool Equals(object obj) { if (obj == this) { return(true); } if (obj != null && obj.GetType() == this.GetType()) { CapitalIndexedBondPosition other = (CapitalIndexedBondPosition)obj; return(JodaBeanUtils.equal(info, other.info) && JodaBeanUtils.equal(product, other.product) && JodaBeanUtils.equal(longQuantity, other.longQuantity) && JodaBeanUtils.equal(shortQuantity, other.shortQuantity)); } return(false); }
internal static CapitalIndexedBondPosition sut2() { return(CapitalIndexedBondPosition.builder().info(POSITION_INFO2).product(PRODUCT2).longQuantity(100).shortQuantity(50).build()); }
//------------------------------------------------------------------------- internal static CapitalIndexedBondPosition sut() { return(CapitalIndexedBondPosition.builder().info(POSITION_INFO).product(PRODUCT).longQuantity(QUANTITY).build()); }
public CapitalIndexedBondPosition withQuantity(double quantity) { return(CapitalIndexedBondPosition.ofNet(info, product, quantity)); }