@Test
@Transactional
public void saveResourceWithCalendar() throws InstanceNotFoundException {
Resource resource = givenValidWorker();
ResourceCalendar resourceCalendar = givenValidResourceCalendar();
resource.setCalendar(resourceCalendar);
resourceDAO.save(resource);
resourceDAO.flush();
sessionFactory.getCurrentSession().evict(resource);
Resource foundResource = resourceDAO.find(resource.getId());
assertNotSame(resource, foundResource);
assertNotNull(foundResource.getCalendar());
assertThat(foundResource.getCalendar().getId(),
equalTo(resourceCalendar.getId()));
}