package de.gurkenlabs.litiengine.abilities;

import static org.mockito.Mockito.mock;

import org.junit.Assert;
import org.junit.Test;

import de.gurkenlabs.litiengine.annotation.AbilityInfo;
import de.gurkenlabs.litiengine.entities.IMovableCombatEntity;

public class AbilityTests {

  @Test
  public void testInitialization() {
    IMovableCombatEntity entity = mock(IMovableCombatEntity.class);
    TestAbility ability = new TestAbility(entity);

    Assert.assertEquals("I do somethin", ability.getName());
    Assert.assertEquals("does somethin", ability.getDescription());
    Assert.assertEquals(CastType.ONCONFIRM, ability.getCastType());
    Assert.assertEquals(true, ability.isMultiTarget());

    Assert.assertEquals(333, ability.getAttributes().getCooldown().getCurrentValue().intValue());
    Assert.assertEquals(222, ability.getAttributes().getDuration().getCurrentValue().intValue());
    Assert.assertEquals(111, ability.getAttributes().getImpact().getCurrentValue().intValue());
    Assert.assertEquals(99, ability.getAttributes().getImpactAngle().getCurrentValue().intValue());
    Assert.assertEquals(444, ability.getAttributes().getRange().getCurrentValue().intValue());
    Assert.assertEquals(999, ability.getAttributes().getValue().getCurrentValue().intValue());
  }

  @AbilityInfo(castType = CastType.ONCONFIRM, name = "I do somethin", description = "does somethin", cooldown = 333, duration = 222, impact = 111, impactAngle = 99, multiTarget = true, origin = AbilityOrigin.COLLISIONBOX_CENTER, range = 444, value = 999)
  private class TestAbility extends Ability {

    protected TestAbility(IMovableCombatEntity executor) {
      super(executor);
    }
  }
}

@@ -128,16 +128,138 @@
 .Test;%0A%0A
+import de.gurkenlabs.litiengine.abilities.effects.Effect;%0Aimport de.gurkenlabs.litiengine.abilities.effects.EffectTarget;%0A
 import d
@@ -306,16 +306,16 @@
 tyInfo;%0A
-
 import d
@@ -1405,16 +1405,641 @@
 );%0A  %7D%0A%0A
+  @Test%0A  public void testEffectInitialization() %7B%0A    IMovableCombatEntity entity = mock(IMovableCombatEntity.class);%0A    TestAbility ability = new TestAbility(entity);%0A%0A    Effect effect = new TestEffect(ability, EffectTarget.ENEMY);%0A    Assert.assertEquals(ability.getAttributes().getDuration().getCurrentValue().intValue(), effect.getDuration());%0A    Assert.assertEquals(ability, effect.getAbility());%0A    Assert.assertEquals(0, effect.getFollowUpEffects().size());%0A    Assert.assertFalse(effect.isActive(entity));%0A    Assert.assertArrayEquals(new EffectTarget%5B%5D %7B EffectTarget.ENEMY %7D, effect.getEffectTargets());%0A%0A  %7D%0A%0A
   @Abili
@@ -2387,24 +2387,24 @@
 executor) %7B%0A
-
       super(
@@ -2423,11 +2423,166 @@
    %7D%0A  %7D
+%0A%0A  private class TestEffect extends Effect %7B%0A    protected TestEffect(Ability ability, EffectTarget... targets) %7B%0A      super(ability, targets);%0A    %7D%0A  %7D
 %0A%7D%0A

Add simple initialization test for the effects.