<commit_before>package org.luxons.sevenwonders.game;

import java.util.Arrays;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.theories.DataPoints;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.luxons.sevenwonders.game.Lobby.GameAlreadyStartedException;
import org.luxons.sevenwonders.game.Lobby.PlayerNameAlreadyUsedException;
import org.luxons.sevenwonders.game.Lobby.PlayerOverflowException;
import org.luxons.sevenwonders.game.Lobby.PlayerUnderflowException;
import org.luxons.sevenwonders.game.Lobby.UnknownPlayerException;
import org.luxons.sevenwonders.game.data.GameDefinition;
import org.luxons.sevenwonders.game.data.GameDefinitionLoader;

import static org.junit.Assert.*;
import static org.junit.Assume.*;

@RunWith(Theories.class)
public class LobbyTest {

    @DataPoints
    public static int[] nbPlayers() {
        return new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    }

    @Rule
    public ExpectedException thrown = ExpectedException.none();

    private static GameDefinition gameDefinition;

    private Player gameOwner;

    private Lobby lobby;

    @BeforeClass
    public static void loadDefinition() {
        gameDefinition = new GameDefinitionLoader().getGameDefinition();
    }

    @Before
    public void setUp() {
        gameOwner = new Player("gameowner", "Game owner");
        lobby = new Lobby(0, "Test Game", gameOwner, gameDefinition);
    }

    @Test
    public void isOwner_falseWhenNull() {
        assertFalse(lobby.isOwner(null));
    }

    @Test
    public void isOwner_falseWhenEmptyString() {
        assertFalse(lobby.isOwner(""));
    }

    @Test
    public void isOwner_falseWhenGarbageString() {
        assertFalse(lobby.isOwner("this is garbage"));
    }

    @Test
    public void isOwner_trueWhenOwnerUserName() {
        assertTrue(lobby.isOwner(gameOwner.getUserName()));
    }

    @Test<commit_msg>Add test for Lobby initialization<commit_after>package org.luxons.sevenwonders.game;

import java.util.Arrays;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.theories.DataPoints;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.luxons.sevenwonders.game.Lobby.GameAlreadyStartedException;
import org.luxons.sevenwonders.game.Lobby.PlayerNameAlreadyUsedException;
import org.luxons.sevenwonders.game.Lobby.PlayerOverflowException;
import org.luxons.sevenwonders.game.Lobby.PlayerUnderflowException;
import org.luxons.sevenwonders.game.Lobby.UnknownPlayerException;
import org.luxons.sevenwonders.game.data.GameDefinition;
import org.luxons.sevenwonders.game.data.GameDefinitionLoader;

import static org.junit.Assert.*;
import static org.junit.Assume.*;

@RunWith(Theories.class)
public class LobbyTest {

    @DataPoints
    public static int[] nbPlayers() {
        return new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    }

    @Rule
    public ExpectedException thrown = ExpectedException.none();

    private static GameDefinition gameDefinition;

    private Player gameOwner;

    private Lobby lobby;

    @BeforeClass
    public static void loadDefinition() {
        gameDefinition = new GameDefinitionLoader().getGameDefinition();
    }

    @Before
    public void setUp() {
        gameOwner = new Player("gameowner", "Game owner");
        lobby = new Lobby(0, "Test Game", gameOwner, gameDefinition);
    }

    @Test
    public void testId() {
        Lobby l = new Lobby(5, "Test Game", gameOwner, gameDefinition);
        assertEquals(5, l.getId());
    }

    @Test
    public void testName() {
        Lobby l = new Lobby(5, "Test Game", gameOwner, gameDefinition);
        assertEquals("Test Game", l.getName());
    }

    @Test
    public void isOwner_falseWhenNull() {
        assertFalse(lobby.isOwner(null));
    }

    @Test
    public void isOwner_falseWhenEmptyString() {
        assertFalse(lobby.isOwner(""));
    }

    @Test
    public void isOwner_falseWhenGarbageString() {
        assertFalse(lobby.isOwner("this is garbage"));
    }

    @Test
    public void isOwner_trueWhenOwnerUserName() {
        assertTrue(lobby.isOwner(gameOwner.getUserName()));
    }

    @Test
{'fraction_non_alphanumeric': 0.10701598579040852, 'fraction_numerical': 0.005994671403197158, 'mean_word_length': 3.8755411255411256, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2557710', 'n_tokens_mistral': 1411, 'n_tokens_neox': 1339, 'n_words': 284}