@Test public void testLoadPosition() { final List<Position> loadPositions = loadAllPositions(); final Position testPosition = loadPositions.get(0); // act final Position loadPosition = testee.loadPosition(testPosition.getId()); assertEquals(testPosition.getName(), loadPosition.getName()); }
@Before public void setupTestee() { testee = new DataProvider(); // em.getTransaction().begin(); final Account firstAccount = new MonetaryAccount(); firstAccount.setName("first account"); em.persist(firstAccount); final Position firstPosition = new Position(); firstPosition.setOriginAccount(firstAccount); firstPosition.setName("first position"); firstPosition.setAmount(new Money(5.5, Currency.CHF)); firstPosition.setPositionType(PositionType.CONFIRMED); firstPosition.setValutaDate(new GregorianCalendar(2012, 2, 12).getTime()); em.persist(firstPosition); em.getTransaction().commit(); }