/** Test method for {@link net.bioclipse.brunn.daos.CellOriginDAO#getById(long)}. */ @Test public void testGetById() { CellOrigin cellOrigin = new CellOrigin(tester, "cellOrigin"); getDAO().save(cellOrigin); session.flush(); session.clear(); CellOrigin savedCellOrigin = getDAO().getById(new Long(cellOrigin.getId())); assertEquals(cellOrigin, savedCellOrigin); assertNotSame(cellOrigin, savedCellOrigin); }
@Test public void testDelete() { CellOrigin cellOrigin = new CellOrigin(tester, "cell origin"); assertFalse(cellOrigin.isDeleted()); getDAO().save(cellOrigin); session.flush(); session.clear(); getDAO().delete(cellOrigin); session.flush(); session.clear(); CellOrigin deleted = getDAO().getById(new Long(cellOrigin.getId())); assertTrue(deleted.isDeleted()); }
@Test public void testFindAllByName() { CellOrigin cellOrigin1 = new CellOrigin(tester, "cellOrigin1"); CellOrigin cellOrigin2 = new CellOrigin(tester, "cellOrigin2"); CellOrigin cellOrigin3 = new CellOrigin(tester, "deleted"); cellOrigin3.delete(); getDAO().save(cellOrigin1); getDAO().save(cellOrigin2); getDAO().save(cellOrigin3); session.flush(); session.clear(); List list = getDAO().findAllNotDeleted(); assertTrue(list.contains(cellOrigin1)); assertTrue(list.contains(cellOrigin2)); assertFalse(list.contains(cellOrigin3)); }