Пример #1
0
  @Test
  public void testIsBlocked() {
    StoptableThread thread = new TestThread2();
    thread.setMaxHeartbeatInterval(2);

    assertThat(thread.isBlocked()).isFalse();

    thread.start();

    assertThat(thread.isBlocked()).isFalse();

    ThreadUtils.sleep(1);
    assertThat(thread.isBlocked()).isFalse();

    ThreadUtils.sleep(1.5);

    assertThat(thread.isBlocked()).isTrue();
  }