// @Test public void testRemoveAll() throws SQLException { List<Spread> spreadList = dao.getAllByFlockId(flockId); for (Spread g : spreadList) { dao.remove(g.getId()); } spreadList = dao.getAllByFlockId(flockId); assertEquals(0, spreadList.size()); }
// @Test public void testInsert() throws SQLException { if (!((CreatebleDao) dao).tableExist()) { ((CreatebleDao) dao).createTable(); } spread = new Spread(); spread.setAmount(Integer.valueOf(500)); spread.setDate("29/06/2013"); spread.setFlockId(Long.valueOf(1)); spread.setNumberAccount(Integer.valueOf(5)); spread.setPrice(Float.valueOf("12.34")); spread.setTotal(Float.valueOf("10.25")); dao.insert(spread); assertEquals(5, dao.getAllByFlockId(flockId).size()); List<Spread> spreads = dao.getAllByFlockId(flockId); for (Spread g : spreads) { System.out.println(g); } }
// @Test public void testRemove() throws SQLException { dao.remove(spread.getId()); spread = dao.getById(flockId); assertNull(spread); }