public void bulletPayment_twoTradesTwoParties() {
String location = "classpath:com/opengamma/strata/loader/fpml/bullet-payment-weird.xml";
ByteSource resource = ResourceLocator.of(location).getByteSource();
FpmlPartySelector selector = FpmlPartySelector.matchingRegex(Pattern.compile("Party1[ab]"));
List<Trade> trades = FpmlDocumentParser.of(selector).parseTrades(resource);
assertEquals(trades.size(), 2);
Trade trade0 = trades.get(0);
assertEquals(trade0.getClass(), BulletPaymentTrade.class);
BulletPaymentTrade bpTrade0 = (BulletPaymentTrade) trade0;
assertEquals(bpTrade0.getInfo().getTradeDate(), Optional.of(date(2001, 4, 29)));
assertEquals(bpTrade0.getInfo().getId().get().getValue(), "123");
BulletPayment bp0 = bpTrade0.getProduct();
assertEquals(bp0.getPayReceive(), PAY);
assertEquals(bp0.getDate(), AdjustableDate.of(date(2001, 7, 27), BusinessDayAdjustment.of(MODIFIED_FOLLOWING, GBLO_USNY)));
assertEquals(bp0.getValue(), CurrencyAmount.of(USD, 15000));
Trade trade1 = trades.get(1);
assertEquals(trade1.getClass(), BulletPaymentTrade.class);
BulletPaymentTrade bpTrade1 = (BulletPaymentTrade) trade1;
assertEquals(bpTrade1.getInfo().getTradeDate(), Optional.of(date(2001, 4, 29)));
assertEquals(bpTrade1.getInfo().getId().get().getValue(), "124");
BulletPayment bp1 = bpTrade1.getProduct();
assertEquals(bp1.getPayReceive(), RECEIVE);
assertEquals(bp1.getDate(), AdjustableDate.of(date(2001, 8, 27), BusinessDayAdjustment.of(MODIFIED_FOLLOWING, GBLO_USNY)));
assertEquals(bp1.getValue(), CurrencyAmount.of(USD, 15000));
}