@Test
 public void testEntityNotRemovedIfForceBlockActiveComponentAdded() {
   EntityRef blockEntity = worldProvider.getBlockEntityAt(new Vector3i(0, 0, 0));
   blockEntity.addComponent(new ForceBlockActiveComponent());
   worldProvider.update(1.0f);
   assertTrue(blockEntity.exists());
   assertTrue(blockEntity.isActive());
 }
 @Test
 public void testEntityBecomesTemporaryWhenChangedFromAKeepActiveBlock() {
   worldProvider.setBlock(Vector3i.zero(), keepActiveBlock);
   EntityRef blockEntity = worldProvider.getBlockEntityAt(new Vector3i(0, 0, 0));
   worldProvider.setBlock(Vector3i.zero(), BlockManager.getAir());
   worldProvider.update(1.0f);
   assertFalse(blockEntity.isActive());
 }
 @Test
 public void testEntityBecomesTemporaryIfForceBlockActiveComponentRemoved() {
   EntityRef blockEntity = worldProvider.getBlockEntityAt(new Vector3i(0, 0, 0));
   blockEntity.addComponent(new ForceBlockActiveComponent());
   worldProvider.update(1.0f);
   blockEntity.removeComponent(ForceBlockActiveComponent.class);
   worldProvider.update(1.0f);
   assertFalse(blockEntity.exists());
   assertFalse(blockEntity.isActive());
 }
 private void updateFields(EntityRef interactionTarget) {
   InspectionToolComponent inspectorComponent =
       interactionTarget.getComponent(InspectionToolComponent.class);
   EntityRef inspectedEntity = inspectorComponent.inspectedEntity;
   entityIdField.setText(Long.toString(inspectedEntity.getId()));
   if (inspectedEntity.exists()) {
     if (inspectedEntity.isActive()) {
       fullDescriptionLabel.setText(inspectedEntity.toFullDescription());
     } else {
       fullDescriptionLabel.setText("not active: " + inspectedEntity.toFullDescription());
     }
   } else {
     fullDescriptionLabel.setText("Non existing entity with id " + inspectedEntity.getId());
   }
 }
  @Test
  public void testActiveBlockNotCleanedUp() {
    Block testBlock = new Block();
    testBlock.setKeepActive(true);
    BlockFamily blockFamily = new SymmetricFamily(new BlockUri("test:keepActive"), testBlock);
    blockManager.addBlockFamily(blockFamily, true);
    worldStub.setBlock(Vector3i.zero(), testBlock);

    BlockEventChecker checker = new BlockEventChecker();
    entityManager.getEventSystem().registerEventHandler(checker);

    EntityRef blockEntity = worldProvider.getBlockEntityAt(new Vector3i(0, 0, 0));
    worldProvider.update(1.0f);
    assertTrue(blockEntity.exists());
    assertTrue(blockEntity.isActive());
    assertTrue(checker.addedReceived);
    assertTrue(checker.activateReceived);
  }