public void test_serialization() { assertSerialization(sut()); }
public void test_builder_resolved() { BondFuturePosition test = sut(); assertEquals(test.getProduct(), PRODUCT); assertEquals(test.getInfo(), POSITION_INFO); assertEquals(test.getLongQuantity(), QUANTITY, 0d); assertEquals(test.getShortQuantity(), 0d, 0d); assertEquals(test.getQuantity(), QUANTITY, 0d); assertEquals(test.withInfo(POSITION_INFO).getInfo(), POSITION_INFO); assertEquals(test.withQuantity(129).getQuantity(), 129d, 0d); }
public void test_withQuantity() { BondFuturePosition base = sut(); double quantity = 75343d; BondFuturePosition computed = base.withQuantity(quantity); BondFuturePosition expected = BondFuturePosition.builder() .info(POSITION_INFO) .product(PRODUCT) .longQuantity(quantity) .build(); assertEquals(computed, expected); }
public void test_summarize() { BondFuturePosition tes = sut(); PortfolioItemSummary expected = PortfolioItemSummary.builder() .id(POSITION_INFO.getId().orElse(null)) .portfolioItemType(PortfolioItemType.POSITION) .productType(ProductType.BOND_FUTURE) .currencies(Currency.USD) .description("BondFuture x 10") .build(); assertEquals(tes.summarize(), expected); }
public void test_resolve() { ResolvedBondFutureTrade expected = ResolvedBondFutureTrade.builder() .info(POSITION_INFO) .product(PRODUCT.resolve(REF_DATA)) .quantity(QUANTITY) .build(); assertEquals(sut().resolve(REF_DATA), expected); }