private void setExamplePlayerFavor() { sut.setPlayerFavor(new int[] {1, 1, 2}); sut.setPlayerFavor(new int[] {2, 1, 3}); sut.setPlayerFavor(new int[] {3, 0}); sut.setPlayerFavor(new int[] {4, 2, 2, 3}); sut.setPlayerFavor(new int[] {5, 1, 4}); }
@Test public void testSetTeamSize() throws Exception { // Given int teamSize = 5; // When sut.setTeamSize(teamSize); // Then assertThat(sut.getTeamSize(), is(5)); }
@Test public void testSetPlayerFavor_EmptyList() throws Exception { // Given int[] player1Favor = {3, 0}; List<Integer> playerFavorList = new ArrayList<>(); // When sut.setPlayerFavor(player1Favor); // Then assertThat(sut.getPlayerFavor(3), is(playerFavorList)); }
@Test public void testSetPlayerFavor() throws Exception { // Given int[] player1Favor = {4, 2, 2, 3}; List<Integer> playerFavorList = new ArrayList<>(Arrays.asList(2, 3)); // When sut.setPlayerFavor(player1Favor); // Then assertThat(sut.getPlayerFavor(4), is(playerFavorList)); }
@Test public void testSelectBestTeam() throws Exception { // Given sut.setTeamSize(5); sut.setTeamList(generateExampleTeamList()); // When sut.selectBestTeam(); List<List<Integer>> result = sut.getResultTeam(); // Then assertThat(result.size(), is(2)); assertThat(isExclusiveTeam(result), is(true)); }
@Test public void testGeneratePossibleTeam() throws Exception { // Given sut.setTeamSize(5); setExamplePlayerFavor(); List<List<Integer>> exampleTeamList = generateExampleTeamList(); // When sut.generatePossibleTeam(); // Then assertTrue(sut.getTeamList().containsAll(exampleTeamList)); assertTrue(exampleTeamList.containsAll(sut.getTeamList())); }