//-------------------------------------------------------------------------
        public virtual void test_summarize()
        {
            OvernightFutureTrade trade    = OvernightFutureTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(PRICE).build();
            PortfolioItemSummary expected = PortfolioItemSummary.builder().id(TRADE_INFO.Id.orElse(null)).portfolioItemType(PortfolioItemType.TRADE).productType(ProductType.OVERNIGHT_FUTURE).currencies(Currency.USD).description("OnFuture x 35").build();

            assertEquals(trade.summarize(), expected);
        }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            OvernightFutureTrade test1 = OvernightFutureTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(PRICE).build();

            coverImmutableBean(test1);
            OvernightFutureTrade test2 = OvernightFutureTrade.builder().info(TradeInfo.empty()).product(PRODUCT2).quantity(QUANTITY2).price(PRICE2).build();

            coverBeanEquals(test1, test2);
        }
        public virtual void test_withPrice()
        {
            OvernightFutureTrade @base = OvernightFutureTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(PRICE).build();
            double price = 0.95;
            OvernightFutureTrade computed = @base.withPrice(price);
            OvernightFutureTrade expected = OvernightFutureTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(price).build();

            assertEquals(computed, expected);
        }
        //-------------------------------------------------------------------------
        public virtual void test_resolve()
        {
            OvernightFutureTrade         test     = OvernightFutureTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(PRICE).build();
            ResolvedOvernightFutureTrade resolved = test.resolve(REF_DATA);

            assertEquals(resolved.Info, TRADE_INFO);
            assertEquals(resolved.Product, PRODUCT.resolve(REF_DATA));
            assertEquals(resolved.Quantity, QUANTITY);
            assertEquals(resolved.TradedPrice, TradedPrice.of(TRADE_DATE, PRICE));
        }
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            OvernightFutureTrade test = OvernightFutureTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(PRICE).build();

            assertEquals(test.Info, TRADE_INFO);
            assertEquals(test.Product, PRODUCT);
            assertEquals(test.Price, PRICE);
            assertEquals(test.Quantity, QUANTITY);
            assertEquals(test.withInfo(TRADE_INFO).Info, TRADE_INFO);
            assertEquals(test.withQuantity(0.9129).Quantity, 0.9129d, 1e-10);
            assertEquals(test.withPrice(0.9129).Price, 0.9129d, 1e-10);
        }
        //-------------------------------------------------------------------------
        public virtual void test_createProduct()
        {
            OvernightFutureSecurity test = sut();

            assertEquals(test.createProduct(ReferenceData.empty()), PRODUCT);
            TradeInfo            tradeInfo     = TradeInfo.of(date(2016, 6, 30));
            OvernightFutureTrade expectedTrade = OvernightFutureTrade.builder().info(tradeInfo).product(PRODUCT).quantity(100).price(0.995).build();

            assertEquals(test.createTrade(tradeInfo, 100, 0.995, ReferenceData.empty()), expectedTrade);

            PositionInfo            positionInfo      = PositionInfo.empty();
            OvernightFuturePosition expectedPosition1 = OvernightFuturePosition.builder().info(positionInfo).product(PRODUCT).longQuantity(100).build();

            TestHelper.assertEqualsBean(test.createPosition(positionInfo, 100, ReferenceData.empty()), expectedPosition1);
            OvernightFuturePosition expectedPosition2 = OvernightFuturePosition.builder().info(positionInfo).product(PRODUCT).longQuantity(100).shortQuantity(50).build();

            assertEquals(test.createPosition(positionInfo, 100, 50, ReferenceData.empty()), expectedPosition2);
        }
 public virtual void test_builder_badPrice()
 {
     assertThrowsIllegalArg(() => OvernightFutureTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(2.1).build());
 }
        public virtual void test_serialization()
        {
            OvernightFutureTrade test = OvernightFutureTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(PRICE).build();

            assertSerialization(test);
        }