Skip to content
Snippets Groups Projects
Commit 981b561a authored by Erik Moravec's avatar Erik Moravec Committed by Ján Dovjak
Browse files

refactor: fixed Optional related warnings in tests

parent f6356629
No related branches found
No related tags found
No related merge requests found
......@@ -95,7 +95,7 @@ public class TeamManagerFacadeImplTest {
Team team = buildTeamMock(1L, "Boston Bruins");
when(teamService.findTeam(1L)).thenReturn(Optional.ofNullable(team));
Player player = buildPlayerMock(1L, "David Pastrnak", team);
when(playerService.findPlayer(1L)).thenReturn(Optional.ofNullable(player));
when(playerService.findPlayer(1L)).thenReturn(Optional.of(player));
teamManagerFacade.firePlayer(1L);
verify(teamService).removePlayerFromTeam(team, player);
verify(playerService).removeTeamFromPlayer(player, team);
......
......@@ -76,14 +76,14 @@ class UserFacadeImplTest {
var player = mock(Player.class);
when(player.getId()).thenReturn(1L);
when(player.getName()).thenReturn("Satan");
when(playerService.findPlayer(1)).thenReturn(Optional.ofNullable(player));
when(playerService.findPlayer(1)).thenReturn(Optional.of(player));
var expected = new PlayerDto();
expected.setId(1L);
expected.setName("Satan");
Optional<PlayerDto> result = userFacade.findPlayer(1);
Assertions.assertThat(result).isEqualTo(Optional.ofNullable(expected));
Assertions.assertThat(result).isEqualTo(Optional.of(expected));
verify(playerService).findPlayer(1);
}
......
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