Ejemplo n.º 1
0
  @Test
  public void createMethodGetterAndSetterTest() {
    Book book = new Book();
    book.setDateRecieved(new Date());
    book.setRecieved(true);
    book.setReciever("some");

    Dao<Integer, Book> dao = dbLite.getDao(Book.class);
    long id = dao.create(book);
    Assert.assertTrue(id > 0);
  }
Ejemplo n.º 2
0
  @Test
  public void privateFieldsGetterAndSetterMethodTest() {
    Book book = new Book();
    book.setId(1);
    book.setReciever("Mario");
    book.setAmountSent(2);
    book.setDateRecieved(new Date());
    book.setRecieved(true);

    Dao<Integer, Book> dao = dbLite.getDao(Book.class);
    long rowID = dao.create(book);
    Assert.assertEquals(book.getId(), rowID);

    Book bookDB = dao.findById(book.getId());
    Assert.assertEquals(book.getReciever(), bookDB.getReciever());
    Assert.assertEquals(book.getAmountSent(), bookDB.getAmountSent());
    Assert.assertEquals(book.isRecieved(), bookDB.isRecieved());
    Assert.assertEquals(book.getDateRecieved(), bookDB.getDateRecieved());
  }