import Ġcom . m cm acker 4 . ecs . Component Ċ import Ġcom . m cm acker 4 . ecs . Entity Ċ import Ġorg . junit . jupiter . api . Assertions .* Ċ import Ġorg . junit . jupiter . api . BeforeEach Ċ import Ġorg . junit . jupiter . api . Test Ċ Ċ class ĠComponent 1 Ġ: ĠComponent () Ċ Ċ class ĠComponent 2 Ġ: ĠComponent () Ċ Ċ class ĠEC ST est Ġ{ ĊĠĠĠĠĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġentity : ĠEntity ĊĠĠĠĠĊĠĠĠ Ġ@ BeforeEach ĊĠĠĠ Ġfun Ġpre test () Ġ{ ĊĠĠĠĠĠĠĠ Ġentity Ġ= ĠEntity () ĊĠĠĠ Ġ} ĊĠĠĠĠĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġadd Component () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertFalse ( entity . has Component ( Component 1 :: class )) ĊĠĠĠĠĠĠĠ ĠassertFalse ( entity . has Component ( Component 2 :: class )) ĊĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠ Ġentity . addComponent ( Component 1 ()) ĊĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠ ĠassertTrue ( entity . has Component ( Component 1 :: class )) ĊĠĠĠĠĠĠĠ ĠassertFalse ( entity . has Component ( Component 2 :: class )) ĊĠĠĠ Ġ} ĊĠĠĠĠĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Component () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcomponent Ġ= ĠComponent 1 () ĊĠĠĠĠĠĠĠ Ġval Ġcomponent 2 Ġ= ĠComponent 2 () ĊĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠ Ġassert Not Equals ( component , Ġcomponent 2 ) ĊĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠ ĠassertNull ( entity . getComponent ( Component 1 :: class )) ĊĠĠĠĠĠĠĠ ĠassertNull ( entity . getComponent ( Component 2 :: class )) ĊĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠ Ġentity . addComponent ( component ) ĊĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠ ĠassertNotNull ( entity . getComponent ( Component 1 :: class )) ĊĠĠĠĠĠĠĠ ĠassertNull ( entity . getComponent ( Component 2 :: class )) ĊĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠ ĠassertEquals ( entity . getComponent ( Component 1 :: class ), Ġcomponent ) ĊĠĠĠĠĠĠĠ Ġassert Not Equals ( entity . getComponent ( Component 1 :: class ), Ġcomponent 2 ) ĊĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠ Ġentity . addComponent ( component 2 ) ĊĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠ ĠassertNotNull ( entity . getComponent ( Component 1 :: class )) ĊĠĠĠĠĠĠĠ ĠassertNotNull ( entity . getComponent ( Component 2 :: class )) ĊĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠ ĠassertEquals ( entity . getComponent ( Component 1 :: class ), Ġcomponent ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( entity . getComponent ( Component 2 :: class ), Ġcomponent 2 ) ĊĠĠĠĠĠĠĠĠĊĠĠĠ Ġ} ĊĠĠĠĠĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġremove Component () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcomponent Ġ= ĠComponent 1 () ĊĠĠĠĠĠĠĠ Ġval Ġcomponent 2 Ġ= ĠComponent 2 () ĊĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠ Ġentity . addComponent ( component ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( entity . has Component ( Component 1 :: class )) ĊĠĠĠĠĠĠĠ ĠassertFalse ( entity . has Component ( Component 2 :: class )) ĊĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠ Ġentity . addComponent ( component 2 ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( entity . has Component ( Component 1 :: class )) ĊĠĠĠĠĠĠĠ ĠassertTrue ( entity . has Component ( Component 2 :: class )) ĊĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠ Ġentity . remove Component ( Component 1 :: class ) ĊĠĠĠĠĠĠĠ ĠassertFalse ( entity . has Component ( Component 1 :: class )) ĊĠĠĠĠĠĠĠ ĠassertTrue ( entity . has Component ( Component 2 :: class )) ĊĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠ Ġentity . remove Component ( Component 2 :: class ) ĊĠĠĠĠĠĠĠ ĠassertFalse ( entity . has Component ( Component 1 :: class )) ĊĠĠĠĠĠĠĠ ĠassertFalse ( entity . has Component ( Component 2 :: class )) ĊĠĠĠ Ġ} ĊĠĠĠĠ Ċ }