@Test public void loadTeamByIdTest() { userDao.save(insertedUser); projectDao.save(insertedProject); teamDao.save(insertedTeam); teamDao.flushSession(); long teamId = insertedTeam.getIdTeam(); Team loadedTeam = teamDao.loadTeam(teamId); assertEquals("Loaded object is not equal", loadedTeam.getAlias(), insertedTeam.getAlias()); assertEquals("Loaded object is not equal", loadedTeam.getName(), insertedTeam.getName()); }
@Test public void getTeamId() { userDao.save(insertedUser); projectDao.save(insertedProject); teamDao.save(insertedTeam); teamDao.flushSession(); long teamId = teamDao.getTeamId(insertedTeam.getAlias()); assertEquals( "Team's selected id is not equal to expected one", insertedTeam.getIdTeam(), new Long(teamId)); }
@Test public void getTeamsTest() { userDao.save(insertedUser); projectDao.save(insertedProject); teamDao.save(insertedTeam); teamDao.flushSession(); List<Team> teams = teamDao.getTeams(); if (teams.isEmpty()) { fail("List of teams cannot be empty after insert"); } assertEquals( "JDBC query must show the same number of teams", super.countRowsInTable("Teams"), teams.size()); Team team = teams.get(teams.size() - 1); assertEquals("Selected team is not equal", team.getAlias(), "ZZ"); assertEquals("Selected team is not equal", team.getName(), "Test Testowy"); }