27
loading...
This website collects cookies to deliver better user experience
@Before
public void setup(){
service = new RentService();
RentDAO dao = Mockito.mock(RentDAO.class);
service.setRentDao(dao);
spcService = Mockito.mock(SPCService.class);
service.setSpcService(spcService);
}
public void save(Rent rent);
public boolean isNegative(User user);
@Test
public void rentTest() throws Exception {
//given
User user = UserBuilder.aUser().now();
List<Movie> movies = Arrays.asList(MovieBuilder.aMovie().withValue(5.0).now());
//when
Rent rent = service.rentMovie(user, movies);
//then
error.checkThat(rent.getValue(), is(equalTo(5.0)));
error.checkThat(DataUtils.isSameDate(rent.getRentDate(), new Date()), is(true));
error.checkThat(DataUtils.isSameDate(rent.getReturnDate(), DataUtils.obtainDataInDifferenceInDays(1)), is(true));
}