32 lines
881 B
Java
32 lines
881 B
Java
package electrosphere.entity;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
import org.joml.Vector3d;
|
|
|
|
import annotations.UnitTest;
|
|
import electrosphere.engine.Globals;
|
|
import electrosphere.server.datacell.Realm;
|
|
import electrosphere.server.datacell.RealmManager;
|
|
|
|
/**
|
|
* Unit tests for the server entity utils
|
|
*/
|
|
public class ServerEntityUtilsUnitTests {
|
|
|
|
@UnitTest
|
|
public void destroyEntity_ValidEntity_NoRealm(){
|
|
//setup
|
|
Globals.realmManager = new RealmManager();
|
|
Realm realm = Globals.realmManager.createViewportRealm(new Vector3d(0,0,0), new Vector3d(1,1,1));
|
|
Entity entity = EntityCreationUtils.createServerEntity(realm, new Vector3d());
|
|
|
|
//perform action
|
|
ServerEntityUtils.destroyEntity(entity);
|
|
|
|
//verify
|
|
assertEquals(null, Globals.realmManager.getEntityRealm(entity));
|
|
}
|
|
|
|
}
|