コード例 #1
0
        public virtual void test_toBuilder()
        {
            SecurityInfo test = SecurityInfo.builder().addAttribute(AttributeType.NAME, "name").id(ID).priceInfo(PRICE_INFO).build().toBuilder().id(ID2).build();

            assertEquals(test.Id, ID2);
            assertEquals(test.getAttribute(AttributeType.NAME), "name");
        }
コード例 #2
0
        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"));
        }
コード例 #3
0
        public virtual void test_builder()
        {
            SecurityInfo test = SecurityInfo.builder().id(ID).priceInfo(PRICE_INFO).addAttribute(AttributeType.NAME, "B").addAttribute(AttributeType.NAME, "A").build();

            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"));
        }
コード例 #4
0
        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);
        }