Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package repository;
- import model.Rental;
- import model.validators.RentalValidator;
- import org.junit.jupiter.api.Test;
- public class RentalDBRepositoryTest
- {
- @Test
- public void all() {
- Repository<Long, Rental> repo = new RentalDBRepository(new RentalValidator());
- long id = 998;
- Rental rental = new Rental();
- rental.setId(id);
- rental.setMovieID((long)1);
- rental.setClientID((long)2);
- rental.setRentedDate("10/10/2000");
- rental.setDueDate("10/11/2001");
- rental.setReturnedDate("10/12/2002");
- repo.save(rental);
- assert(repo.findOne(id).get().getRentedDate().equals("10/10/2000"));
- assert(!repo.findOne((long) 2).isPresent());
- rental.setRentedDate("10/12/2000");
- repo.update(rental);
- assert(repo.findOne(id).get().getRentedDate().equals("10/12/2000"));
- assert(repo.delete(id).isPresent());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement