コード例 #1
0
  @Test
  public void testDelete() {
    Bookmark bookmark = new Bookmark("Demoiselle Portal", "http://www.frameworkdemoiselle.gov.br");
    bookmarkBC.insert(bookmark);

    List<Bookmark> listaBookmarks = bookmarkBC.findAll();
    assertNotNull(listaBookmarks);
    assertEquals(1, listaBookmarks.size());

    bookmarkBC.delete(bookmark.getId());
    listaBookmarks = bookmarkBC.findAll();
    assertEquals(0, listaBookmarks.size());
  }
コード例 #2
0
  @Test
  public void testUpdate() {
    Bookmark bookmark = new Bookmark("Demoiselle Portal", "http://www.frameworkdemoiselle.gov.br");
    bookmarkBC.insert(bookmark);

    List<Bookmark> listaBookmarks = bookmarkBC.findAll();
    Bookmark bookmark2 = (Bookmark) listaBookmarks.get(0);
    assertNotNull(listaBookmarks);
    assertEquals("Demoiselle Portal", bookmark2.getDescription());

    bookmark2.setDescription("Demoiselle Portal alterado");
    bookmarkBC.update(bookmark2);

    listaBookmarks = bookmarkBC.findAll();
    Bookmark bookmark3 = (Bookmark) listaBookmarks.get(0);
    assertEquals("Demoiselle Portal alterado", bookmark3.getDescription());
  }
コード例 #3
0
 @Before
 public void before() {
   for (Bookmark bookmark : bookmarkBC.findAll()) {
     bookmarkBC.delete(bookmark.getId());
   }
 }