MyInternalEffect basicEffect2 = addBean(new MyInternalEffect());
effectSuite.addEffect(basicEffect1.getId());
effectSuite.addEffect(basicEffect2.getId());
PositionTrigger positionTrigger = new PositionTrigger(
new CircleElement(new Point(20, 20), Color.red, width),
effectSuite.getId(), RectangleElement.class, map.getId());
MapElementFactory.buildMapElement(positionTrigger, map);
positionTrigger = getBeans(positionTrigger);
RectangleElement rectangleElement = new RectangleElement(
new Point(0, 0), Color.BLACK, width, height);
MapElementFactory.buildMapElement(rectangleElement, map);
rectangleElement = getBeans(rectangleElement);
assertTrue("trigger should'nt be activated",
!positionTrigger.isActivate());
assertEquals("the effect should have been activated 0", 0,
basicEffect1.getActivationCount());
assertEquals("the effect should have been desactivated 0", 0,
basicEffect1.getDesactivationCount());
assertEquals("the effect should have been activated 0", 0,
basicEffect2.getActivationCount());
assertEquals("the effect should have been desactivated 0", 0,
basicEffect2.getDesactivationCount());
rectangleElement.setPosition(new Point(20, 20));
sleep(10);
assertTrue("trigger should be activated", positionTrigger.isActivate());
assertEquals("the effect should have been activated 1", 1,
basicEffect1.getActivationCount());
assertEquals("the effect should have been desactivated 0", 0,
basicEffect1.getDesactivationCount());
assertEquals("the effect should have been activated 1", 1,
basicEffect2.getActivationCount());
assertEquals("the effect should have been desactivated 0", 0,
basicEffect2.getDesactivationCount());
rectangleElement.setPosition(new Point(0, 0));
sleep(10);
assertTrue("trigger should'nt be activated",
!positionTrigger.isActivate());
assertEquals("the effect should have been activated 1", 1,
basicEffect1.getActivationCount());
assertEquals("the effect should have been desactivated 1", 1,
basicEffect1.getDesactivationCount());
assertEquals("the effect should have been activated 1", 1,