import org.drools.guvnor.client.modeldriven.testing.VerifyRuleFired;
public class ScenarioTest extends TestCase {
public void testInsertBetween() {
Scenario sc = new Scenario();
VerifyRuleFired vf = new VerifyRuleFired();
sc.insertBetween(null, vf);
assertEquals(1, sc.fixtures.size());
assertEquals(vf, sc.fixtures.get(0));
VerifyRuleFired vf2 = new VerifyRuleFired();
sc.fixtures.add(vf2);
VerifyRuleFired vf3 = new VerifyRuleFired();
sc.insertBetween(vf, vf3);
assertEquals(3, sc.fixtures.size());
assertEquals(vf, sc.fixtures.get(0));
assertEquals(vf2, sc.fixtures.get(1));
assertEquals(vf3, sc.fixtures.get(2));
VerifyRuleFired vf4 = new VerifyRuleFired();
sc.insertBetween(vf2, vf4);
assertEquals(4, sc.fixtures.size());
assertEquals(3, sc.fixtures.indexOf(vf4));
assertEquals(2, sc.fixtures.indexOf(vf3));
//assertEquals(vf4, sc.fixtures.get(3));
assertEquals(1, sc.fixtures.indexOf(vf2));
//assertEquals(vf2, sc.fixtures.get(2));
assertEquals(0, sc.fixtures.indexOf(vf));
VerifyRuleFired vf5 = new VerifyRuleFired();
sc.insertBetween(null, vf5);
assertEquals(5, sc.fixtures.size());
assertEquals(4, sc.fixtures.indexOf(vf5));
sc = new Scenario();
sc.fixtures.add(vf);
ExecutionTrace ex = new ExecutionTrace();
sc.fixtures.add(ex);
sc.insertBetween(null, vf2);
assertEquals(0, sc.fixtures.indexOf(vf));
assertEquals(1, sc.fixtures.indexOf(vf2));
assertEquals(2, sc.fixtures.indexOf(ex));
assertEquals(3, sc.fixtures.size());
sc.insertBetween(ex, vf3);
assertEquals(4, sc.fixtures.size());
assertEquals(0, sc.fixtures.indexOf(vf));
assertEquals(1, sc.fixtures.indexOf(vf2));
assertEquals(2, sc.fixtures.indexOf(ex));
assertEquals(3, sc.fixtures.indexOf(vf3));
ExecutionTrace ex2 = new ExecutionTrace();
sc.fixtures.add(ex2);
sc.insertBetween(ex, vf4);
assertEquals(6, sc.fixtures.size());
assertEquals(0, sc.fixtures.indexOf(vf));
assertEquals(1, sc.fixtures.indexOf(vf2));
assertEquals(2, sc.fixtures.indexOf(ex));
assertEquals(3, sc.fixtures.indexOf(vf3));
assertEquals(4, sc.fixtures.indexOf(vf4));
assertEquals(5, sc.fixtures.indexOf(ex2));
sc.insertBetween(ex2, vf5);
assertEquals(7, sc.fixtures.size());
assertEquals(0, sc.fixtures.indexOf(vf));
assertEquals(1, sc.fixtures.indexOf(vf2));
assertEquals(2, sc.fixtures.indexOf(ex));
assertEquals(3, sc.fixtures.indexOf(vf3));
assertEquals(4, sc.fixtures.indexOf(vf4));
assertEquals(5, sc.fixtures.indexOf(ex2));
assertEquals(6, sc.fixtures.indexOf(vf5));
sc = new Scenario();
sc.fixtures.add(ex);
sc.insertBetween(null, vf);
assertEquals(2, sc.fixtures.size());
assertEquals(0, sc.fixtures.indexOf(vf));
assertEquals(1, sc.fixtures.indexOf(ex));