public void test_builder() { SecurityPosition test = sut(); assertEquals(test.getInfo(), POSITION_INFO); assertEquals(test.getSecurityId(), SECURITY_ID); assertEquals(test.getLongQuantity(), LONG_QUANTITY); assertEquals(test.getShortQuantity(), SHORT_QUANTITY); assertEquals(test.getQuantity(), QUANTITY); }
public void test_ofNet_withInfo_negative() { SecurityPosition test = SecurityPosition.ofNet(POSITION_INFO, SECURITY_ID, -100d); assertEquals(test.getInfo(), POSITION_INFO); assertEquals(test.getSecurityId(), SECURITY_ID); assertEquals(test.getLongQuantity(), 0d); assertEquals(test.getShortQuantity(), 100d); assertEquals(test.getQuantity(), -100d); }
// ------------------------------------------------------------------------- public void test_ofNet_noInfo() { SecurityPosition test = SecurityPosition.ofNet(SECURITY_ID, QUANTITY); assertEquals(test.getInfo(), PositionInfo.empty()); assertEquals(test.getSecurityId(), SECURITY_ID); assertEquals(test.getLongQuantity(), QUANTITY); assertEquals(test.getShortQuantity(), 0d); assertEquals(test.getQuantity(), QUANTITY); }
public void test_ofLongShort_withInfo() { SecurityPosition test = SecurityPosition.ofLongShort(POSITION_INFO, SECURITY_ID, LONG_QUANTITY, SHORT_QUANTITY); assertEquals(test.getInfo(), POSITION_INFO); assertEquals(test.getSecurityId(), SECURITY_ID); assertEquals(test.getLongQuantity(), LONG_QUANTITY); assertEquals(test.getShortQuantity(), SHORT_QUANTITY); assertEquals(test.getQuantity(), QUANTITY); }