Skip to content
Snippets Groups Projects
Commit f8c481c0 authored by Erik Moravec's avatar Erik Moravec
Browse files

test: fixed test for add away games and added remove home games tests

parent 4f814b88
No related branches found
No related tags found
No related merge requests found
......@@ -166,7 +166,7 @@ class TeamServiceImplTest {
Team team = buildTeam("Florida Panthers");
Game game = buildGame();
teamService.addAwayGame(team, game);
assertThat(team.getHomeGames()).hasSameElementsAs(List.of(game));
assertThat(team.getAwayGames()).hasSameElementsAs(List.of(game));
verify(teamDao).update(team);
}
......@@ -176,7 +176,7 @@ class TeamServiceImplTest {
assertThatExceptionOfType(NullPointerException.class).isThrownBy(
() -> teamService.addAwayGame(team, null)
);
assertThat(team.getHomeGames()).hasSameElementsAs(List.of());
assertThat(team.getAwayGames()).hasSameElementsAs(List.of());
}
@Test
......@@ -187,6 +187,33 @@ class TeamServiceImplTest {
);
}
@Test
public void removeHomeGame() {
Team team = buildTeam("Florida Panthers");
Game game = buildGame();
team.setHomeGames(Set.of(game));
teamService.removeHomeGame(team, game);
assertThat(team.getHomeGames()).hasSameElementsAs(List.of());
verify(teamDao).update(team);
}
@Test
public void removeHomeGameGameIsNull() {
Team team = buildTeam("Florida Panthers");
assertThatExceptionOfType(NullPointerException.class).isThrownBy(
() -> teamService.addHomeGame(team, null)
);
assertThat(team.getHomeGames()).hasSameElementsAs(List.of());
}
@Test
public void removeHomeGameTeamIsNull() {
Game game = buildGame();
assertThatExceptionOfType(NullPointerException.class).isThrownBy(
() -> teamService.addHomeGame(null, game)
);
}
private Game buildGame() {
var game = new Game();
game.setId(1L);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment