Skip to content

Instantly share code, notes, and snippets.

@junkdog
Last active December 30, 2015 22:39
Show Gist options
  • Save junkdog/7895219 to your computer and use it in GitHub Desktop.
Save junkdog/7895219 to your computer and use it in GitHub Desktop.
import static org.junit.Assert.*;
import com.artemis.Entity;
import com.artemis.World;
import org.junit.Test;
public class Test {
@Test
public void entity_is_no_longer_active_after_deletion() {
World world = new World();
world.initialize();
// Create entity
Entity ent = world.createEntity();
ent.addToWorld();
world.process();
assertTrue(ent.isActive());
// Delete it from world
world.deleteEntity(ent);
world.process();
// Entity non-active
assertFalse(ent.isActive());
// Create another entity
Entity ent2 = world.createEntity();
ent2.addToWorld();
world.process();
// ent2 reuses ent instance
assertSame(ent, ent2);
// Bug: Entity is active again!
// assertFalse(ent.isActive());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment