/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(EtdFuturePosition beanToCopy) { this.info = beanToCopy.getInfo(); this.security = beanToCopy.getSecurity(); this.longQuantity = beanToCopy.getLongQuantity(); this.shortQuantity = beanToCopy.getShortQuantity(); }
public void test_methods() { EtdFuturePosition test = sut(); assertEquals(test.getType(), EtdType.FUTURE); assertEquals(test.getCurrency(), Currency.GBP); assertEquals(test.getSecurityId(), test.getSecurity().getSecurityId()); assertEquals(test.getQuantity(), 1000d, 0d); }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 3237038: // info return ((EtdFuturePosition) bean).getInfo(); case 949122880: // security return ((EtdFuturePosition) bean).getSecurity(); case 611668775: // longQuantity return ((EtdFuturePosition) bean).getLongQuantity(); case -2094395097: // shortQuantity return ((EtdFuturePosition) bean).getShortQuantity(); case -1285004149: // quantity return ((EtdFuturePosition) bean).getQuantity(); } return super.propertyGet(bean, propertyName, quiet); }
public void test_ofNet_withInfo() { EtdFuturePosition test = EtdFuturePosition.ofNet(POSITION_INFO, SECURITY, 1000); assertEquals(test.getLongQuantity(), 1000d, 0d); assertEquals(test.getShortQuantity(), 0d, 0d); assertEquals(test.getInfo(), POSITION_INFO); assertEquals(test.getSecurity(), SECURITY); assertEquals(test.getQuantity(), 1000d, 0d); }
public void test_ofLongShort_withInfo() { EtdFuturePosition test = EtdFuturePosition.ofLongShort(POSITION_INFO, SECURITY, 2000, 1000); assertEquals(test.getLongQuantity(), 2000d, 0d); assertEquals(test.getShortQuantity(), 1000d, 0d); assertEquals(test.getInfo(), POSITION_INFO); assertEquals(test.getSecurity(), SECURITY); assertEquals(test.getQuantity(), 1000d, 0d); }
public void test_ofNet_short() { EtdFuturePosition test = EtdFuturePosition.ofNet(SECURITY, -1000); assertEquals(test.getLongQuantity(), 0d, 0d); assertEquals(test.getShortQuantity(), 1000d, 0d); assertEquals(test.getSecurity(), SECURITY); assertEquals(test.getQuantity(), -1000d, 0d); }
public void test_ofLongShort() { EtdFuturePosition test = EtdFuturePosition.ofLongShort(SECURITY, 2000, 1000); assertEquals(test.getLongQuantity(), 2000d, 0d); assertEquals(test.getShortQuantity(), 1000d, 0d); assertEquals(test.getSecurity(), SECURITY); assertEquals(test.getQuantity(), 1000d, 0d); }
public void test_ofNet() { EtdFuturePosition test = EtdFuturePosition.ofNet(SECURITY, 1000); assertEquals(test.getLongQuantity(), 1000d, 0d); assertEquals(test.getShortQuantity(), 0d, 0d); assertEquals(test.getSecurity(), SECURITY); assertEquals(test.getQuantity(), 1000d, 0d); assertEquals(test.withInfo(POSITION_INFO).getInfo(), POSITION_INFO); assertEquals(test.withQuantity(129).getQuantity(), 129d, 0d); assertEquals(test.withQuantity(-129).getQuantity(), -129d, 0d); }