@Transactional @Test public void shouldReturnAllTeam() throws Exception { String ateamName = "The A Team"; Team ateam = TeamBuilder.newBuilder().withName(ateamName).create(); teamDao.save(ateam); String bteamName = "The B Team"; Team bteam = TeamBuilder.newBuilder().withName(bteamName).create(); teamDao.save(bteam); List<Team> allTeams = teamDao.getAll(); assertNotNull("allTeams must not be null", allTeams); assertEquals("allTeams size", 2, allTeams.size()); }
@Transactional @Test public void shouldReturnATeam() throws Exception { String teamName = "The A Team"; Team team = TeamBuilder.newBuilder().withName(teamName).create(); teamDao.save(team); Team teamFromDB = teamDao.getByName(teamName); assertEquals("Team Name", teamName, teamFromDB.getTeamName()); }