AssignmentDaoImpl implements AssignmentDao { @Override @Transactional(rollbackFor = Throwable.class) public void deleteAll() { Query query = getSession().createQuery("DELETE FROM Assignment"); query.executeUpdate(); }  @Autowired @Qualifier("assignmentSessionFactory") void setSessionFactory(SessionFactory sessionFactory); @Override @Transactional(readOnly = true) List<Assignment> getAll(Date date); @Override @Transactional(readOnly = true) Assignment getAssignment(String blockId, Date date); @Override @Transactional(rollbackFor = Throwable.class) void save(Assignment assignment); @Override @Transactional(rollbackFor = Throwable.class) void saveAll(List<Assignment> assignmentList); @Override @Transactional(rollbackFor = Throwable.class) void delete(Assignment assignment); @Override @Transactional(rollbackFor = Throwable.class) void deleteAll();  }
@Test public void deleteAllTest() { Date currentServiceDate = currentServiceDate(); Assignment retrievedAssignment = _dao.getAssignment("blockId", currentServiceDate); assertNull(retrievedAssignment); Assignment assignment = new Assignment("blockId", "vehicleId", currentServiceDate); _dao.save(assignment); retrievedAssignment = _dao.getAssignment("blockId", currentServiceDate); assertNotNull(retrievedAssignment); _dao.deleteAll(); retrievedAssignment = _dao.getAssignment("blockId", currentServiceDate); assertNull(retrievedAssignment); }