use of com.autentia.tnt.dao.hibernate.UserDAO in project TNTConcept by autentia.
the class ContractExpirationNotificationBean_IT method should_send_email_when_contract_expires_in_1_day.
@Test
public void should_send_email_when_contract_expires_in_1_day() throws MessagingException {
// create a user with a contract ending tomorrow
User user = SpringUtilsForTesting.createUser("contract-1d");
user.setEndContractDate(Date.from(LocalDate.now().plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant()));
UserDAO userDAO = (UserDAO) SpringUtils.getSpringBean("daoUser");
userDAO.insert(user);
ContractExpirationNotificationBean sut = new ContractExpirationNotificationBean(mailService);
int userCount = sut.checkExpirationDate();
assertThat(userCount, is(1));
}
use of com.autentia.tnt.dao.hibernate.UserDAO in project TNTConcept by autentia.
the class ContractExpirationNotificationBean_IT method should_send_email_when_probation_period_expires_in_3_months.
@Test
public void should_send_email_when_probation_period_expires_in_3_months() throws MessagingException {
// create a user with a probation of 3 months from now
User user = SpringUtilsForTesting.createUser("probation-3m");
user.setEndTestPeriodDate(Date.from(LocalDate.now().plusMonths(3).atStartOfDay(ZoneId.systemDefault()).toInstant()));
UserDAO userDAO = (UserDAO) SpringUtils.getSpringBean("daoUser");
userDAO.insert(user);
ContractExpirationNotificationBean sut = new ContractExpirationNotificationBean(mailService);
int userCount = sut.checkExpirationDate();
assertThat(userCount, is(1));
}
use of com.autentia.tnt.dao.hibernate.UserDAO in project TNTConcept by autentia.
the class ContractExpirationNotificationBean_IT method should_not_send_email_when_probation_expires_in_3_months_and_1_day.
@Test
public void should_not_send_email_when_probation_expires_in_3_months_and_1_day() throws MessagingException {
// create a user with a probation ending in 3 months and 1 day
User user = SpringUtilsForTesting.createUser("probation-3m-1d");
user.setEndTestPeriodDate(Date.from(LocalDate.now().plusMonths(3).plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant()));
UserDAO userDAO = (UserDAO) SpringUtils.getSpringBean("daoUser");
userDAO.insert(user);
ContractExpirationNotificationBean sut = new ContractExpirationNotificationBean(mailService);
int userCount = sut.checkExpirationDate();
assertThat(userCount, is(0));
}
Aggregations