package hundsfickerei.schafkopf.server.model;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

public class GameTest {

    @Test
    public void testRandomSoloPlayerGame() {
        Game game = new Game();
        List<Player> players = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            players.add(new RandomSoloPlayer(game));
        }
        game.init(players);
        game.start();
        int sum = 0;
        for (Player player : players) {
            sum = sum + player.getPoints();
        }
        assertThat(sum, is(equalTo(120)));
    }

}

@@ -67,299 +67,1022 @@
 st;%0A
-%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport static org.hamcrest.Matchers.equalTo;%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.junit.Assert.assertThat;%0A%0Apublic class GameTest %7B%0A%0A    @Test%0A    public void testRandomSoloPlayerGame() %7B%0A        Game game = new Game(
+import org.springframework.context.ApplicationContext;%0Aimport org.springframework.context.annotation.AnnotationConfigApplicationContext;%0Aimport org.springframework.context.annotation.Bean;%0Aimport org.springframework.context.annotation.Configuration;%0Aimport org.springframework.context.annotation.Scope;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport static org.hamcrest.Matchers.equalTo;%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.junit.Assert.assertThat;%0A%0Apublic class GameTest %7B%0A%0A    @Configuration%0A    public static class TestConfig %7B%0A        @Bean%0A        @Scope(%22prototype%22)%0A        public Game game() %7B%0A            return new Game();%0A        %7D%0A        @Bean%0A        @Scope(%22prototype%22)%0A        public Player player(Game game) %7B%0A            return new RandomSoloPlayer(game);%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void testRandomSoloPlayerGame() %7B%0A        ApplicationContext ctx = new AnnotationConfigApplicationContext(TestConfig.class);%0A        Game game = ctx.getBean(Game.class
 );%0A 
@@ -1192,37 +1192,42 @@
 ers.add(
-new RandomSoloPlayer(
+ctx.getBean(Player.class, 
 game));%0A

introduce spring ioc