/**
* update a position that doesn't have any trades. position's quantity should match trade and trade should be added
*/
@Test
public void updatePositionWithNoTrades() {
ManageablePosition position = new ManageablePosition(BigDecimal.valueOf(42), APPLE_SECURITY.getExternalIdBundle());
ManageablePosition savedPosition = _positionMaster.add(new PositionDocument(position)).getPosition();
assertEquals(BigDecimal.valueOf(42), savedPosition.getQuantity());
_tradeBuilder.updatePosition(createTradeData("AAPL US Equity", null), savedPosition.getUniqueId());
ManageablePosition updatedPosition = _positionMaster.get(savedPosition.getUniqueId().getObjectId(),
VersionCorrection.LATEST).getPosition();
assertEquals(BigDecimal.valueOf(30), updatedPosition.getQuantity());
assertEquals(1, updatedPosition.getTrades().size());
ManageableTrade trade = updatedPosition.getTrades().get(0);
assertEquals(LocalDate.of(2012, 12, 21), trade.getTradeDate());
assertEquals(OffsetTime.of(LocalTime.of(14, 25), ZoneOffset.UTC), trade.getTradeTime());
assertEquals(APPLE_BUNDLE, trade.getSecurityLink().getExternalId());
assertEquals(1234d, trade.getPremium());
assertEquals(Currency.USD, trade.getPremiumCurrency());