コード例 #1
0
  @Test
  public void testRewind() {
    // Test 1
    // Testing if rewind works with send event being null.
    boolean caughtException = false;
    try {
      exec.rewind(null, false);
    } catch (IgstkvtRewindException e) {
      caughtException = true;
    }

    if (!caughtException) {
      fail("This should throw an Exception.");
    }

    // Test 2
    // TEsting if the functionality works.
    caughtException = false;

    try {
      exec.rewind(event, false);
    } catch (IgstkvtRewindException e) {
      caughtException = true;
    }

    if (caughtException) {
      fail("This should NOT throw exception.");
    }
  }
コード例 #2
0
  @Test
  public void testTriggerEvent() {
    // Test 1
    // Testing sending null to trigger event.
    boolean caughtException = false;
    try {
      exec.triggerEvent(null);
    } catch (IgstkvtInvalidEventException e) {
      caughtException = true;
    }

    if (!caughtException) {
      fail("This should throw an Exception.");
    }

    // Test 2
    // TEsting if the functionality works.
    caughtException = false;

    try {
      exec.triggerEvent(event);
    } catch (IgstkvtInvalidEventException e) {
      e.printStackTrace();
      caughtException = true;
    }

    if (caughtException) {
      fail("This should NOT throw exception.");
    }
  }
コード例 #3
0
  @Test
  public void testReset() {
    // Test 1
    // Testing if reset works.

    exec.reset();

    assertTrue(exec.getCurrentState().equals("IdleState"));
  }