예제 #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 searchByDirector method, of class DvdLibraryDaoImpl. */
  @Test
  public void testSearchByDirector() {
    System.out.println("searchByDirector");

    String director = "Director2";
    dvdLibraryDao.create(dvd1);
    dvd1.setDirector("Director2");
    dvdLibraryDao.update(dvd1);
    dvdLibraryDao.create(dvd2);
    dvdLibraryDao.create(dvd3);

    List<Dvd> result = dvdLibraryDao.searchByDirector(director);
    List<Dvd> expResult = new ArrayList<>();
    expResult.add(dvd1);
    expResult.add(dvd2);

    Assert.assertEquals(expResult, result);
  }
예제 #8
0
  /** Test of searchByMpaaRating method, of class DvdLibraryDaoImpl. */
  @Test
  public void testSearchByMpaaRating() {
    System.out.println("searchByMpaaRating");

    dvdLibraryDao.create(dvd1);
    dvdLibraryDao.create(dvd2);
    dvdLibraryDao.create(dvd3);
    dvd2.setMpaaRating("Rating1");
    dvdLibraryDao.update(dvd2);

    String rating = "Rating1";

    List<Dvd> result = dvdLibraryDao.searchByMpaaRating(rating);
    List<Dvd> expResult = new ArrayList<>();

    expResult.add(dvd1);
    expResult.add(dvd2);
    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);
  }