Ejemplo n.º 1
0
  /**
   * Test method for {@link
   * net.bioclipse.brunn.daos.FolderDAO#save(net.bioclipse.brunn.pojos.Folder)}.
   */
  @Test
  public void testSave() {

    Folder folder = new Folder(tester, "folder", projects);
    getDAO().save(folder);

    session.flush();
    session.clear();

    Folder savedFolder = getDAO().getById(folder.getId());
    assertEquals(folder, savedFolder);
    assertNotSame(folder, savedFolder);
  }
Ejemplo n.º 2
0
  /** Test method for {@link net.bioclipse.brunn.daos.FolderDAO#getById(long)}. */
  @Test
  public void testGetById() {

    Folder folder = new Folder(tester, "folder", projects);
    Folder subFolder = new Folder(tester, "subFolder", folder);
    getDAO().save(folder);

    session.flush();
    session.clear();

    Folder savedFolder = getDAO().getById(folder.getId());
    Folder savedSubFolder = getDAO().getById(subFolder.getId());

    assertEquals(folder, savedFolder);
    assertEquals(subFolder, savedSubFolder);
    assertNotSame(folder, savedFolder);
    assertTrue(folder.getObjects().contains(subFolder));
  }
Ejemplo n.º 3
0
  @Test
  public void testDelete() {

    Folder folder = new Folder(tester, "folder", projects);
    assertFalse(folder.isDeleted());
    getDAO().save(folder);

    session.flush();
    session.clear();

    getDAO().delete(folder);

    session.flush();
    session.clear();

    Folder deleted = getDAO().getById(new Long(folder.getId()));
    assertTrue(deleted.isDeleted());
  }