Skip to content

Commit

Permalink
✅ : corrects test based on mutation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juwit committed Jan 9, 2020
1 parent a96ac1f commit 3f55583
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package io.codeka.gaia.teams.controller;

import io.codeka.gaia.teams.Team;
import io.codeka.gaia.teams.repository.TeamRepository;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@ExtendWith(MockitoExtension.class)
class TeamsRestControllerTest {
Expand All @@ -20,8 +25,15 @@ class TeamsRestControllerTest {

@Test
void teams_shouldReturnAllTeams() {
teamsRestController.teams();
// given
var a = new Team("A");
when(teamRepository.findAll()).thenReturn(List.of(a));

// when
var teams = teamsRestController.teams();

// then
assertThat(teams).contains(a);
verify(teamRepository).findAll();
}
}

0 comments on commit 3f55583

Please sign in to comment.