@Test
public void testFindHoldingsByAccount() {
Integer page = 0;
Integer pageSize = 10;
Holding holding100 = holdingDataOnDemand.getNewTransientHolding(100);
Holding holding101 = holdingDataOnDemand.getNewTransientHolding(101);
holding101.setAccountAccountid(holding100.getAccountAccountid());
holdingRepository.save(holding100);
holdingRepository.save(holding101);
entityManager.flush();
entityManager.clear(); // force reload
List<Holding> holdings = tradingService.findHoldingsByAccountId(holding100.getAccountAccountid(), page, pageSize);
assertEquals(2, holdings.size());
Map<Integer, Holding> map = new HashMap<Integer, Holding>();
map.put(holdings.get(0).getHoldingid(), holdings.get(0));
map.put(holdings.get(1).getHoldingid(), holdings.get(1));
assertNotNull(map.remove(holding100.getHoldingid()));
assertNotNull(map.remove(holding101.getHoldingid()));
}