Ejemplo n.º 1
0
  /** Ensures that, if the id is valid, then retrieving a bookmark works as expected. */
  @Test
  public void testGet() {
    Bookmark result = dao.get(existing_bookmark.getId());

    assertNotNull(result);
    assertEquals(existing_bookmark.getId(), result.getId());
  }
Ejemplo n.º 2
0
  /** Ensures that removing a bookmark works as expected. */
  @Test
  public void testRemove() {
    dao.remove(existing_bookmark.getId());

    Bookmark result = dao.get(existing_bookmark.getId());

    assertNull(result);
  }
Ejemplo n.º 3
0
  /** Ensures that updating a bookmark works as expected. */
  @Test
  public void testUpdate() {
    existing_bookmark.setName(existing_bookmark.getName().toUpperCase());

    dao.update(existing_bookmark);

    Bookmark result = dao.get(existing_bookmark.getId());

    assertNotNull(result);
    assertEquals(existing_bookmark.getName(), result.getName());
  }
Ejemplo n.º 4
0
  @Override
  @Before
  public void setUp() throws Exception {
    super.setUp();

    dao = dbFacade.getBookmarkDao();

    // create some test data
    new_bookmark = new Bookmark();
    Random r = new Random(System.currentTimeMillis());
    new_bookmark.setName("newbookmarkname" + (r.nextInt() % BOOKMARK_MAX_RANDOM_NUMBER));
    new_bookmark.setValue("newbookmarkvalue");

    existing_bookmark = dao.get(new Guid("a4affabf-7b45-4a6c-b0a9-107d0bbe265e"));
  }
Ejemplo n.º 5
0
 /** Ensures that if the id is invalid then no bookmark is returned. */
 @Test
 public void testGetWithInvalidId() {
   Bookmark result = dao.get(Guid.newGuid());
   assertNull(result);
 }