Exemple #1
0
 @Test
 public void getTeamByIdTest() {
   userDao.save(insertedUser);
   projectDao.save(insertedProject);
   teamDao.save(insertedTeam);
   teamDao.flushSession();
   long insertedTeamId = insertedTeam.getIdTeam();
   Team selectedTeam = teamDao.getTeam(insertedTeamId);
   assertEquals("Selected teams are not equal", selectedTeam, insertedTeam);
 }
Exemple #2
0
 @Test
 public void saveTest() {
   userDao.save(insertedUser);
   projectDao.save(insertedProject);
   int rowsBeforeSave = super.countRowsInTable("Teams");
   teamDao.save(insertedTeam);
   teamDao.flushSession();
   int rowsAfterSave = super.countRowsInTable("Teams");
   assertEquals("Number of rows has not increased", rowsBeforeSave + 1, rowsAfterSave);
   long insertedTeamId = insertedTeam.getIdTeam();
   assertEquals("Teams are not equal", teamDao.getTeam(insertedTeamId), insertedTeam);
 }
Exemple #3
0
 @Test
 public void deleteByIdTest() {
   userDao.save(insertedUser);
   projectDao.save(insertedProject);
   int rowsBeforeInsert = super.countRowsInTable("Teams");
   teamDao.save(insertedTeam);
   teamDao.flushSession();
   long teamId = insertedTeam.getIdTeam();
   teamDao.delete(teamId);
   teamDao.flushSession();
   int rowsAfterDelete = super.countRowsInTable("Teams");
   assertEquals(
       "JDBC query must return the same number of teams", rowsBeforeInsert, rowsAfterDelete);
   Team selectedTeam = teamDao.getTeam(teamId);
   assertNull("Selected team after delete should be null", selectedTeam);
 }