@Test public void getTeamsBySprint() { userDao.save(insertedUser); projectDao.save(insertedProject); pbiDao.save(insertedPBI); sprintDao.save(insertedSprint); teamDao.save(insertedTeam); workItemDao.save(insertedWorkItem); teamDao.flushSession(); List<Team> teams = teamDao.getTeamsForSprint(insertedSprint); if (teams.size() != 1) { fail("List should have one related team"); } assertEquals("Selected team is not equal", teams.get(0), insertedTeam); }
@Test public void countTeamsForSprintTest() { userDao.save(insertedUser); projectDao.save(insertedProject); pbiDao.save(insertedPBI); sprintDao.save(insertedSprint); teamDao.save(insertedTeam); workItemDao.save(insertedWorkItem); teamDao.flushSession(); assertEquals("Count number is not valid", 1, teamDao.countTeamsForSprint(insertedSprint)); workItemDao.delete(insertedWorkItem); teamDao.delete(insertedTeam); teamDao.flushSession(); assertEquals("Count number is not valid", 0, teamDao.countTeamsForSprint(insertedSprint)); }
@Test public void deleteWithWorkItemsTest() { userDao.save(insertedUser); projectDao.save(insertedProject); pbiDao.save(insertedPBI); sprintDao.save(insertedSprint); teamDao.save(insertedTeam); workItemDao.save(insertedWorkItem); insertedTeam.addWorkItem(insertedWorkItem); insertedWorkItem.setTeam(insertedTeam); teamDao.flushSession(); long idTeam = insertedTeam.getIdTeam(); teamDao.delete(insertedTeam); teamDao.flushSession(); int counter = super.simpleJdbcTemplate.queryForInt( "select count(*) from Teams where idTeam=?", new Object[] {idTeam}); assertEquals("JDBC query must return no teams with this id", 0, counter); counter = super.simpleJdbcTemplate.queryForInt( "select count(*) from WorkItems where idTeam=?", new Object[] {idTeam}); assertEquals("JDBC query must return no workItems with this id", 0, counter); }