public virtual void test_summarize() { BillPosition @base = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(QUANTITY1).build(); PortfolioItemSummary expected = PortfolioItemSummary.builder().id(POSITION_INFO1.Id.orElse(null)).portfolioItemType(PortfolioItemType.POSITION).productType(ProductType.BILL).currencies(USD).description("Bill2019-05-23 x 10").build(); assertEquals(@base.summarize(), expected); }
public virtual void test_resolve() { BillPosition @base = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(QUANTITY1).build(); ResolvedBillTrade computed = @base.resolve(REF_DATA); ResolvedBillTrade expected = ResolvedBillTrade.builder().info(POSITION_INFO1).product(PRODUCT1.resolve(REF_DATA)).quantity(QUANTITY1).build(); assertEquals(computed, expected); }
public virtual void test_withInfo() { BillPosition @base = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(QUANTITY1).build(); BillPosition computed1 = @base.withInfo(POSITION_INFO2); BillPosition expected1 = BillPosition.builder().info(POSITION_INFO2).product(PRODUCT1).longQuantity(QUANTITY1).build(); assertEquals(computed1, expected1); }
//------------------------------------------------------------------------- public virtual void coverage() { BillPosition test1 = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(QUANTITY1).build(); coverImmutableBean(test1); BillPosition test2 = BillPosition.builder().info(POSITION_INFO2).product(PRODUCT2).shortQuantity(QUANTITY1).build(); coverBeanEquals(test1, test2); }
public virtual void test_createPosition() { BillSecurity test = BillSecurity.builder().dayCount(DAY_COUNT).info(INFO).legalEntityId(LEGAL_ENTITY).notional(NOTIONAL).settlementDateOffset(SETTLE).yieldConvention(YIELD_CONVENTION).build(); Bill product = Bill.builder().dayCount(DAY_COUNT).securityId(SECURITY_ID).dayCount(DAY_COUNT).legalEntityId(LEGAL_ENTITY).notional(NOTIONAL).settlementDateOffset(SETTLE).yieldConvention(YIELD_CONVENTION).build(); PositionInfo positionInfo = PositionInfo.empty(); BillPosition expectedPosition1 = BillPosition.builder().info(positionInfo).product(product).longQuantity(100).build(); assertEquals(test.createPosition(positionInfo, 100, ReferenceData.empty()), expectedPosition1); BillPosition expectedPosition2 = BillPosition.builder().info(positionInfo).product(product).longQuantity(100).shortQuantity(50).build(); assertEquals(test.createPosition(positionInfo, 100, 50, ReferenceData.empty()), expectedPosition2); }
public virtual void test_withQuantity() { BillPosition @base = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(QUANTITY1).build(); double quantity = 1234d; BillPosition computed1 = @base.withQuantity(quantity); BillPosition expected1 = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(quantity).build(); assertEquals(computed1, expected1); BillPosition computed2 = @base.withQuantity(-quantity); BillPosition expected2 = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).shortQuantity(quantity).build(); assertEquals(computed2, expected2); }
public virtual void test_builder_of() { BillPosition test = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(QUANTITY1).shortQuantity(QUANTITY2).build(); assertEquals(test.Currency, USD); assertEquals(test.Id, POSITION_INFO1.Id); assertEquals(test.Info, POSITION_INFO1); assertEquals(test.LongQuantity, QUANTITY1); assertEquals(test.ShortQuantity, QUANTITY2); assertEquals(test.Product, PRODUCT1); assertEquals(test.Quantity, QUANTITY1 - QUANTITY2); assertEquals(test.SecurityId, PRODUCT1.SecurityId); BillPosition test1 = BillPosition.ofLongShort(POSITION_INFO1, PRODUCT1, QUANTITY1, QUANTITY2); assertEquals(test, test1); }
public virtual void test_serialization() { BillPosition test = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(QUANTITY1).build(); assertSerialization(test); }