@Test public void testGetRentalListAsObject() { Object[][] arr = ds.getRentalListAsObject(); assertNotNull(arr); assertEquals(arr.length, ds.getRentalList().size()); assertEquals(8, arr[0].length); }
public Object[][] getRentalListAsObject() { int listSize = rentalList != null ? rentalList.size() : 0; Object[][] rentalArray = new Object[listSize][8]; if (rentalList != null) { int i = 0; for (Rental r : rentalList) { rentalArray[i][0] = r.getId(); rentalArray[i][1] = r.getRentalDays(); rentalArray[i][2] = dateFormat.format(r.getRentalDate()); rentalArray[i][3] = r.getUser().getName(); rentalArray[i][4] = r.getUser().getFirstName(); rentalArray[i][5] = r.getMovie().getTitle(); rentalArray[i][6] = r.calcRemainingDaysOfRental(new Date(Calendar.getInstance().getTimeInMillis())); rentalArray[i][7] = r.getRentalFee(); r.setRentalDays((Integer) rentalArray[i][1]); i++; } } return rentalArray; }
DataSet { public Object[][] getRentalListAsObject() { int listSize = rentalList != null ? rentalList.size() : 0; Object[][] rentalArray = new Object[listSize][8]; if (rentalList != null) { int i = 0; for (Rental r : rentalList) { rentalArray[i][0] = r.getId(); rentalArray[i][1] = r.getRentalDays(); rentalArray[i][2] = dateFormat.format(r.getRentalDate()); rentalArray[i][3] = r.getUser().getName(); rentalArray[i][4] = r.getUser().getFirstName(); rentalArray[i][5] = r.getMovie().getTitle(); rentalArray[i][6] = r.calcRemainingDaysOfRental(new Date(Calendar.getInstance().getTimeInMillis())); rentalArray[i][7] = r.getRentalFee(); r.setRentalDays((Integer) rentalArray[i][1]); i++; } } return rentalArray; } }
DataSet { public Object[][] getRentalListAsObject() { int listSize = rentalList != null ? rentalList.size() : 0; Object[][] rentalArray = new Object[listSize][8]; if (rentalList != null) { int i = 0; for (Rental r : rentalList) { rentalArray[i][0] = r.getId(); rentalArray[i][1] = r.getRentalDays(); rentalArray[i][2] = dateFormat.format(r.getRentalDate()); rentalArray[i][3] = r.getUser().getName(); rentalArray[i][4] = r.getUser().getFirstName(); rentalArray[i][5] = r.getMovie().getTitle(); rentalArray[i][6] = r.calcRemainingDaysOfRental(new Date(Calendar.getInstance().getTimeInMillis())); rentalArray[i][7] = r.getRentalFee(); r.setRentalDays((Integer) rentalArray[i][1]); i++; } } return rentalArray; } DataSet(DateFormat dateFormat); }
DataSet { public Object[][] getRentalListAsObject() { int listSize = rentalList != null ? rentalList.size() : 0; Object[][] rentalArray = new Object[listSize][8]; if (rentalList != null) { int i = 0; for (Rental r : rentalList) { rentalArray[i][0] = r.getId(); rentalArray[i][1] = r.getRentalDays(); rentalArray[i][2] = dateFormat.format(r.getRentalDate()); rentalArray[i][3] = r.getUser().getName(); rentalArray[i][4] = r.getUser().getFirstName(); rentalArray[i][5] = r.getMovie().getTitle(); rentalArray[i][6] = r.calcRemainingDaysOfRental(new Date(Calendar.getInstance().getTimeInMillis())); rentalArray[i][7] = r.getRentalFee(); r.setRentalDays((Integer) rentalArray[i][1]); i++; } } return rentalArray; } DataSet(DateFormat dateFormat); List<IUser> getUserList(); IUser getUserById(int id); IUser getUserByName(String name); void updateRentalsWithUser(User user); Object[][] getUserListAsObject(); List<Movie> getMovieList(); Object[][] getMovieListAsObject(boolean rented, boolean available); Movie getMovieById(long id); void updateMovie(Movie movie); Object[][] getMovieListAsObject(); List<Rental> getRentalList(); Object[][] getRentalListAsObject(); @Override int hashCode(); @Override boolean equals(Object obj); }
DataSet { public Object[][] getRentalListAsObject() { int listSize = rentalList != null ? rentalList.size() : 0; Object[][] rentalArray = new Object[listSize][8]; if (rentalList != null) { int i = 0; for (Rental r : rentalList) { rentalArray[i][0] = r.getId(); rentalArray[i][1] = r.getRentalDays(); rentalArray[i][2] = dateFormat.format(r.getRentalDate()); rentalArray[i][3] = r.getUser().getName(); rentalArray[i][4] = r.getUser().getFirstName(); rentalArray[i][5] = r.getMovie().getTitle(); rentalArray[i][6] = r.calcRemainingDaysOfRental(new Date(Calendar.getInstance().getTimeInMillis())); rentalArray[i][7] = r.getRentalFee(); r.setRentalDays((Integer) rentalArray[i][1]); i++; } } return rentalArray; } DataSet(DateFormat dateFormat); List<IUser> getUserList(); IUser getUserById(int id); IUser getUserByName(String name); void updateRentalsWithUser(User user); Object[][] getUserListAsObject(); List<Movie> getMovieList(); Object[][] getMovieListAsObject(boolean rented, boolean available); Movie getMovieById(long id); void updateMovie(Movie movie); Object[][] getMovieListAsObject(); List<Rental> getRentalList(); Object[][] getRentalListAsObject(); @Override int hashCode(); @Override boolean equals(Object obj);  }