/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(EtdOptionPosition beanToCopy) { this.info = beanToCopy.getInfo(); this.security = beanToCopy.getSecurity(); this.longQuantity = beanToCopy.getLongQuantity(); this.shortQuantity = beanToCopy.getShortQuantity(); }
public void test_methods() { EtdOptionPosition test = sut(); assertEquals(test.getType(), EtdType.OPTION); 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 ((EtdOptionPosition) bean).getInfo(); case 949122880: // security return ((EtdOptionPosition) bean).getSecurity(); case 611668775: // longQuantity return ((EtdOptionPosition) bean).getLongQuantity(); case -2094395097: // shortQuantity return ((EtdOptionPosition) bean).getShortQuantity(); case -1285004149: // quantity return ((EtdOptionPosition) bean).getQuantity(); } return super.propertyGet(bean, propertyName, quiet); }
public void test_ofNet_short() { EtdOptionPosition test = EtdOptionPosition.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() { EtdOptionPosition test = EtdOptionPosition.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_withInfo() { EtdOptionPosition test = EtdOptionPosition.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() { EtdOptionPosition test = EtdOptionPosition.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() { EtdOptionPosition test = EtdOptionPosition.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); }