@Test public void testStoreTeam_newTeam() { Team team = new Team(); expect(teamDAO.create(team)).andReturn(555); expect(teamDAO.get(555)).andReturn(team); replayAll(); Team actual = teamBusiness.storeTeam(team, null, null, null); verifyAll(); assertEquals(team, actual); }
@Test public void testStoreTeam_existing() { Team team = new Team(); team.setId(123); User user = new User(); expect(userBusiness.retrieve(22)).andReturn(user); expect(userBusiness.retrieve(13)).andReturn(new User()); teamDAO.store(team); replayAll(); Team actual = teamBusiness.storeTeam(team, new HashSet<Integer>(Arrays.asList(22, 13)), null, null); verifyAll(); assertEquals(team, actual); assertEquals(2, team.getUsers().size()); assertTrue(team.getUsers().contains(user)); }