Пример #1
0
  /** 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);
  }
Пример #2
0
  @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());
  }
Пример #3
0
  @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));
  }