assertTrue(storedDoc.getPosition().getTrades().contains(trade2));
}
@Test
public void test_getTradePosition_withAttributes() {
final ManageablePosition position = new ManageablePosition(BigDecimal.TEN, ExternalId.of("A", "B"));
final LocalDate tradeDate = _now.toLocalDate();
final OffsetTime tradeTime = _now.toOffsetTime().minusSeconds(500);
final ManageableTrade trade1 = new ManageableTrade(BigDecimal.TEN, ExternalId.of("A", "B"), tradeDate, tradeTime, ExternalId.of("CPS", "CPV"));
trade1.addAttribute("key11", "Value11");
trade1.addAttribute("key12", "Value12");
position.getTrades().add(trade1);
final ManageableTrade trade2 = new ManageableTrade(BigDecimal.TEN, ExternalId.of("C", "D"), tradeDate, tradeTime, ExternalId.of("CPS2", "CPV2"));
trade2.addAttribute("key21", "Value21");
trade2.addAttribute("key22", "Value22");
position.getTrades().add(trade2);
final PositionDocument doc = new PositionDocument();
doc.setPosition(position);
_posMaster.add(doc);
assertNotNull(trade1.getUniqueId());
assertNotNull(trade2.getUniqueId());
assertEquals(trade1, _posMaster.getTrade(trade1.getUniqueId()));
assertEquals(trade2, _posMaster.getTrade(trade2.getUniqueId()));
final PositionDocument storedDoc = _posMaster.get(position.getUniqueId());
assertNotNull(storedDoc);
assertNotNull(storedDoc.getPosition());
assertNotNull(storedDoc.getPosition().getTrades());
assertEquals(2, storedDoc.getPosition().getTrades().size());
assertTrue(storedDoc.getPosition().getTrades().contains(trade1));