コード例 #1
0
 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);
 }
コード例 #2
0
 // -------------------------------------------------------------------------
 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);
 }