Exemple #1
0
  /**
   * DOCUMENT ME!
   *
   * @return DOCUMENT ME!
   */
  public boolean hasNext() {
    while (!hasElement && (co.getState() != Coroutine.State.FINISHED)) {
      co.run();
    }

    return hasElement;
  }
  @Test
  public void testInherit() {
    final C dut = new C();
    Coroutine c =
        new Coroutine(
            new Runnable() {
              public void run() throws SuspendExecution {
                dut.myMethod();
              }
            });
    for (int i = 0; i < 3; i++) {
      c.run();
    }

    assertEquals(5, dut.result.size());
    assertEquals("a", dut.result.get(0));
    assertEquals("o1", dut.result.get(1));
    assertEquals("o2", dut.result.get(2));
    assertEquals("b", dut.result.get(3));
    assertEquals("b", dut.result.get(4));
  }