コード例 #1
0
  @Test
  public void testUpdate6() {

    dvdLibraryDao.create(dvd4);

    dvdLibraryDao.get(dvd4.getId()).setReleaseDate(date4a);
    dvdLibraryDao.update(dvd4);

    Date result = dvdLibraryDao.get(dvd4.getId()).getReleaseDate();
    Date expResult = date4a;

    Assert.assertEquals(expResult, result);
  }
コード例 #2
0
  @Test
  public void testUpdate5() {

    dvdLibraryDao.create(dvd4);

    dvdLibraryDao.get(dvd4.getId()).setUserRating(5);
    dvdLibraryDao.update(dvd4);

    int result = dvdLibraryDao.get(dvd4.getId()).getUserRating();
    int expResult = 5;

    Assert.assertEquals(expResult, result);
  }
コード例 #3
0
  @Test
  public void testUpdate4() {

    dvdLibraryDao.create(dvd4);

    dvdLibraryDao.get(dvd4.getId()).setStudio("Studio4Edit");
    dvdLibraryDao.update(dvd4);

    String result = dvdLibraryDao.get(dvd4.getId()).getStudio();
    String expResult = "Studio4Edit";

    Assert.assertEquals(expResult, result);
  }
コード例 #4
0
  @Test
  public void testUpdate3() {

    dvdLibraryDao.create(dvd4);

    dvdLibraryDao.get(dvd4.getId()).setDirector("Director4Edit");
    dvdLibraryDao.update(dvd4);

    String result = dvdLibraryDao.get(dvd4.getId()).getDirector();
    String expResult = "Director4Edit";

    Assert.assertEquals(expResult, result);
  }
コード例 #5
0
  @Test
  public void testUpdate2() {

    dvdLibraryDao.create(dvd4);

    dvdLibraryDao.get(dvd4.getId()).setMpaaRating("Rating4Edit");
    dvdLibraryDao.update(dvd4);

    String result = dvdLibraryDao.get(dvd4.getId()).getMpaaRating();
    String expResult = "Rating4Edit";

    Assert.assertEquals(expResult, result);
  }
コード例 #6
0
  /** Test of update method, of class DvdLibraryDaoImpl. */
  @Test
  public void testUpdate() {
    System.out.println("update");

    dvdLibraryDao.create(dvd4);

    dvdLibraryDao.get(dvd4.getId()).setTitle("Title4Edit");

    dvdLibraryDao.update(dvd4);

    String result = dvdLibraryDao.get(dvd4.getId()).getTitle();
    String expResult = "Title4Edit";

    Assert.assertEquals(expResult, result);
  }
コード例 #7
0
  /** Test of get method, of class DvdLibraryDaoImpl. */
  @Test
  public void testGet() {
    System.out.println("get");

    dvdLibraryDao.create(dvd1);

    Dvd result = dvdLibraryDao.get(dvd1.getId());
    Dvd expResult = dvd1;

    Assert.assertEquals(expResult, result);
  }
コード例 #8
0
  @Test
  public void testGet3() {

    dvdLibraryDao.create(dvd1);
    dvdLibraryDao.create(dvd2);
    dvdLibraryDao.create(dvd3);

    Dvd result = dvdLibraryDao.get(dvd3.getId());
    Dvd expResult = dvd3;

    Assert.assertEquals(expResult, result);
  }
コード例 #9
0
  /** Test of searchByTitle method, of class DvdLibraryDaoImpl. */
  @Test
  public void testSearchByTitle() {
    System.out.println("searchByTitle");

    dvdLibraryDao.create(dvd1);
    dvdLibraryDao.create(dvd2);
    dvdLibraryDao.get(dvd2.getId()).setTitle("Title1");
    dvdLibraryDao.update(dvd2);

    String title = "Title1";

    List<Dvd> result = dvdLibraryDao.searchByTitle(title);
    List<Dvd> expResult = new ArrayList<>();

    expResult.add(dvd1);
    expResult.add(dvd2);

    Assert.assertEquals(expResult, result);
  }