//-------------------------------------------------------------------------
        public virtual void coverage()
        {
            SecurityInfo test = SecurityInfo.of(ID, PRICE_INFO);

            coverImmutableBean(test);
            SecurityInfo test2 = SecurityInfo.of(ID2, PRICE_INFO2).withAttribute(AttributeType.NAME, "A");

            coverBeanEquals(test, test2);
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------
        public virtual void test_resolveTarget()
        {
            SecurityPosition        position         = sut();
            GenericSecurity         resolvedSecurity = GenericSecurity.of(SecurityInfo.of(SECURITY_ID, 1, CurrencyAmount.of(USD, 0.01)));
            ImmutableReferenceData  refData          = ImmutableReferenceData.of(SECURITY_ID, resolvedSecurity);
            GenericSecurityPosition expected         = GenericSecurityPosition.ofLongShort(POSITION_INFO, resolvedSecurity, LONG_QUANTITY, SHORT_QUANTITY);

            assertEquals(position.resolveTarget(refData), expected);
        }
        public virtual void test_of_withAdditionalInfo()
        {
            SecurityInfo test = SecurityInfo.of(ID, PRICE_INFO).withAttribute(AttributeType.NAME, "B").withAttribute(AttributeType.NAME, "A");     // overwrites "B"

            assertEquals(test.Id, ID);
            assertEquals(test.PriceInfo, PRICE_INFO);
            assertEquals(test.Attributes, INFO_MAP);
            assertEquals(test.getAttribute(AttributeType.NAME), "A");
            assertEquals(test.findAttribute(AttributeType.NAME), ("A"));
        }
        public virtual void test_of_priceInfo()
        {
            SecurityInfo test = SecurityInfo.of(ID, PRICE_INFO);

            assertEquals(test.Id, ID);
            assertEquals(test.PriceInfo, PRICE_INFO);
            assertEquals(test.Attributes, ImmutableMap.of());
            assertThrowsIllegalArg(() => test.getAttribute(AttributeType.NAME));
            assertEquals(test.findAttribute(AttributeType.NAME), null);
        }
        public virtual void test_serialization()
        {
            SecurityInfo test = SecurityInfo.of(ID, PRICE_INFO);

            assertSerialization(test);
        }