@Test
@Transactional
public void testStoreSubcontractedTaskData()
throws InstanceNotFoundException {
Task task = createValidTask();
SubcontractedTaskData subcontractedTaskData = SubcontractedTaskData
.create(task);
subcontractedTaskData.addRequiredDeliveringDates(SubcontractorDeliverDate
.create(new Date(),new Date(), null));
subcontractedTaskData.setExternalCompany(getSubcontractorExternalCompanySaved());
task.setSubcontractedTaskData(subcontractedTaskData);
taskElementDAO.save(task);
taskElementDAO.flush();
sessionFactory.getCurrentSession().evict(task);
sessionFactory.getCurrentSession().evict(subcontractedTaskData);
Task taskFound = (Task) taskElementDAO.find(task.getId());
assertNotNull(taskFound.getSubcontractedTaskData());
SubcontractedTaskData subcontractedTaskDataFound = subcontractedTaskDataDAO
.find(subcontractedTaskData.getId());
assertNotNull(subcontractedTaskDataFound.getTask());
}