<commit_before>/*
 * FXGL - JavaFX Game Library. The MIT License (MIT).
 * Copyright (c) AlmasB (<EMAIL>).
 * See LICENSE for details.
 */

package com.almasb.fxgl.entity

import java.util.Optional
import java.util.function.Predicate
import com.almasb.fxgl.entity.component.Component
import com.almasb.fxgl.entity.components.IDComponent
import com.almasb.fxgl.entity.components.IrremovableComponent
import com.almasb.fxgl.entity.components.TimeComponent
import com.almasb.fxgl.entity.components.TypeComponent
import com.almasb.fxgl.entity.level.Level
import com.almasb.fxgl.physics.BoundingShape
import com.almasb.fxgl.physics.HitBox
import javafx.geometry.Point2D
import javafx.geometry.Point3D
import javafx.geometry.Rectangle2D
import org.hamcrest.BaseMatcher
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.CoreMatchers.not
import org.hamcrest.Description
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.contains
import org.hamcrest.Matchers.containsInAnyOrder
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import org.junit.jupiter.api.function.Executable

class GameWorldTest {

    private lateinit var gameWorld: GameWorld

    @BeforeEach
    fun `init`() {
        gameWorld = GameWorld()
    }

    @Test
    fun `Add entity`() {
        val e = Entity()

        gameWorld.addEntity(e)

        assertThat(gameWorld.entities, contains(e))
    }

    @Test
    fun `Throw when removing entity not attached to this world`() {
        val e = Entity()

        val newWorld = GameWorld()
        newWorld.addEntity(e)

        assertDoesNotThrow {
            gameWorld.removeEntity(e)
        }

        assertTrue(gameWorld.entities.isEmpty())
        assertTrue(newWorld.entities.size === 1)
    }

    @Test
    fun `Add multiple entities`() {
        val e = Entity()
        val e2 = Entity()

        gameWorld.addEntities(e, e2)

        assertThat(gameWorld.entities, containsInAnyOrder(e, e2))
    }
<commit_msg>Updated tests to reflect add/remove entity being ignored<commit_after>/*
 * FXGL - JavaFX Game Library. The MIT License (MIT).
 * Copyright (c) AlmasB (<EMAIL>).
 * See LICENSE for details.
 */

package com.almasb.fxgl.entity

import java.util.Optional
import java.util.function.Predicate
import com.almasb.fxgl.entity.component.Component
import com.almasb.fxgl.entity.components.IDComponent
import com.almasb.fxgl.entity.components.IrremovableComponent
import com.almasb.fxgl.entity.components.TimeComponent
import com.almasb.fxgl.entity.components.TypeComponent
import com.almasb.fxgl.entity.level.Level
import com.almasb.fxgl.physics.BoundingShape
import com.almasb.fxgl.physics.HitBox
import javafx.geometry.Point2D
import javafx.geometry.Point3D
import javafx.geometry.Rectangle2D
import org.hamcrest.BaseMatcher
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.CoreMatchers.not
import org.hamcrest.Description
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.contains
import org.hamcrest.Matchers.containsInAnyOrder
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import org.junit.jupiter.api.function.Executable

class GameWorldTest {

    private lateinit var gameWorld: GameWorld

    @BeforeEach
    fun `init`() {
        gameWorld = GameWorld()
    }

    @Test
    fun `Add entity`() {
        val e = Entity()

        gameWorld.addEntity(e)

        assertThat(gameWorld.entities, contains(e))
    }

    @Test
    fun `Ignore when removing entity not attached to this world`() {
        val e = Entity()

        val newWorld = GameWorld()
        newWorld.addEntity(e)

        assertDoesNotThrow {
            gameWorld.removeEntity(e)
        }

        assertTrue(gameWorld.entities.isEmpty())
        assertTrue(newWorld.entities.size === 1)
    }

    @Test
    fun `Add multiple entities`() {
        val e = Entity()
        val e2 = Entity()

        gameWorld.addEntities(e, e2)

        assertThat(gameWorld.entities, containsInAnyOrder(e, e2))
    }

{'fraction_non_alphanumeric': 0.09928571428571428, 'fraction_numerical': 0.0033333333333333335, 'mean_word_length': 3.4643995749202974, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5832019', 'n_tokens_mistral': 1334, 'n_tokens_neox': 1319, 'n_words': 267}