OtcTradeBuilder extends AbstractTradeBuilder { UniqueId updatePosition(UniqueId positionId, BeanDataSource tradeData, BeanDataSource securityData, BeanDataSource underlyingData) { ManageableTrade trade = buildTrade(tradeData); ManageablePosition position = getPositionMaster().get(positionId).getPosition(); ManageableSecurity previousSecurity = loadSecurity(position.getSecurityLink()); return updateSecuritiesAndPosition(securityData, underlyingData, trade, previousSecurity, positionId); } OtcTradeBuilder(PositionMaster positionMaster,
                                PortfolioMaster portfoioMaster,
                                SecurityMaster securityMaster,
                                Set<MetaBean> metaBeans,
                                StringConvert stringConvert);   }
@Test @SuppressWarnings("deprecation") public void updatePositionWithNoTrade() { ManageableSecurity security = _securityMaster.add(new SecurityDocument(BlotterTestUtils.FX_FORWARD)).getSecurity(); ManageablePosition position = new ManageablePosition(); position.setQuantity(BigDecimal.ONE); position.setSecurityLink(new ManageableSecurityLink(security.getUniqueId())); ManageablePosition savedPosition = _positionMaster.add(new PositionDocument(position)).getPosition(); BeanDataSource updatedTradeData = createTradeData("counterparty", "updatedCounterparty", "tradeDate", "2012-12-22", "premium", "4321"); BeanDataSource updatedSecurityData = BlotterTestUtils.overrideBeanData(BlotterTestUtils.FX_FORWARD_DATA_SOURCE, "payCurrency", "AUD", "payAmount", "200"); _builder.updatePosition(savedPosition.getUniqueId(), updatedTradeData, updatedSecurityData, null); ManageablePosition loadedPosition = _positionMaster.get(savedPosition.getUniqueId()).getPosition(); assertEquals(1, loadedPosition.getTrades().size()); ManageableTrade trade = loadedPosition.getTrades().get(0); assertEquals("updatedCounterparty", trade.getCounterpartyExternalId().getValue()); assertEquals(LocalDate.of(2012, 12, 22), trade.getTradeDate()); assertEquals(4321d, trade.getPremium()); FXForwardSecurity updatedSecurity = (FXForwardSecurity) _securityMaster.get(trade.getSecurityLink().getObjectId(), VersionCorrection.LATEST).getSecurity(); assertEquals(Currency.AUD, updatedSecurity.getPayCurrency()); assertEquals(200d, updatedSecurity.getPayAmount()); }