public void testShortSequence() {
    // walk through just 4 steps
    AITest a = new AITest();

    retval = false;
    invoked = -1;
    ivalue = -1;

    Assert.assertEquals("before start, running ", false, a.isRunning());

    // start to state 1, invokes test1
    a.start();
    Assert.assertEquals("start invoked ", 1, invoked);
    Assert.assertEquals("at start running ", true, a.isRunning());

    // reply 1, state 1 -> 2, invokes test2
    a.programmingOpReply(12, jmri.ProgListener.OK);
    Assert.assertEquals("reply 1 invoked ", 2, invoked);
    Assert.assertEquals("reply 1 value ", 12, ivalue);
    Assert.assertEquals("reply 1 running ", true, a.isRunning());

    // reply 2, state 2 -> 3, invokes test3
    a.programmingOpReply(13, jmri.ProgListener.OK);
    Assert.assertEquals("reply 2 invoked ", 3, invoked);
    Assert.assertEquals("reply 2 value ", 13, ivalue);
    Assert.assertEquals("reply 2 running ", true, a.isRunning());

    // reply 3, state 3 -> 4, invokes test4
    a.programmingOpReply(14, jmri.ProgListener.OK);
    Assert.assertEquals("reply 3 invoked ", 4, invoked);
    Assert.assertEquals("reply 3 value ", 14, ivalue);
    Assert.assertEquals("reply 3 running ", true, a.isRunning());

    // reply 4, state 4 -> 5, invokes test5, which ends
    retval = true;
    a.programmingOpReply(15, jmri.ProgListener.OK);
    Assert.assertEquals("reply 4 invoked ", 5, invoked);
    Assert.assertEquals("reply 4 value ", 15, ivalue);
    Assert.assertEquals("reply 4 running ", false, a.isRunning());
  }
  public void testFullSequence() {
    // walk through all 8 steps
    AITest a = new AITest();

    retval = false;
    invoked = -1;
    ivalue = -1;

    Assert.assertEquals("before start, running ", false, a.isRunning());

    // start to state 1, invokes test1
    a.start();
    Assert.assertEquals("start invoked ", 1, invoked);
    Assert.assertEquals("at start running ", true, a.isRunning());

    // reply 1, state 1 -> 2, invokes test2
    a.programmingOpReply(12, jmri.ProgListener.OK);
    Assert.assertEquals("reply 1 invoked ", 2, invoked);
    Assert.assertEquals("reply 1 value ", 12, ivalue);
    Assert.assertEquals("reply 1 running ", true, a.isRunning());

    // reply 2, state 2 -> 3, invokes test3
    a.programmingOpReply(13, jmri.ProgListener.OK);
    Assert.assertEquals("reply 2 invoked ", 3, invoked);
    Assert.assertEquals("reply 2 value ", 13, ivalue);
    Assert.assertEquals("reply 2 running ", true, a.isRunning());

    // reply 3, state 3 -> 4, invokes test4
    a.programmingOpReply(14, jmri.ProgListener.OK);
    Assert.assertEquals("reply 3 invoked ", 4, invoked);
    Assert.assertEquals("reply 3 value ", 14, ivalue);
    Assert.assertEquals("reply 3 running ", true, a.isRunning());

    // reply 4, state 4 -> 5, invokes test5
    a.programmingOpReply(15, jmri.ProgListener.OK);
    Assert.assertEquals("reply 4 invoked ", 5, invoked);
    Assert.assertEquals("reply 4 value ", 15, ivalue);
    Assert.assertEquals("reply 4 running ", true, a.isRunning());

    // reply 5, state 5 -> 6, invokes test6
    a.programmingOpReply(16, jmri.ProgListener.OK);
    Assert.assertEquals("reply 5 invoked ", 6, invoked);
    Assert.assertEquals("reply 5 value ", 16, ivalue);
    Assert.assertEquals("reply 5 running ", true, a.isRunning());

    // reply 6, state 6 -> 7, invokes test7
    a.programmingOpReply(17, jmri.ProgListener.OK);
    Assert.assertEquals("reply 6 invoked ", 7, invoked);
    Assert.assertEquals("reply 6 value ", 17, ivalue);
    Assert.assertEquals("reply 6 running ", true, a.isRunning());

    // reply 7, state 7 -> 8, invokes test8
    retval = true;
    a.programmingOpReply(18, jmri.ProgListener.OK);
    Assert.assertEquals("reply 7 invoked ", 8, invoked);
    Assert.assertEquals("reply 7 value ", 18, ivalue);
    Assert.assertEquals("reply 7 running ", false, a.isRunning());
  }