<commit_before>package au.com.williamhill.flywheel.util;

import static com.obsidiandynamics.indigo.util.TestSupport.*;
import static junit.framework.TestCase.*;

import java.util.concurrent.*;

import org.junit.*;

public final class AwaitTest {
  @Test(expected=InterruptedException.class)
  public void testInterrupt() throws InterruptedException, TimeoutException {
    Thread.currentThread().interrupt();
    Await.perpetual(20, () -> false);
  }
  
  @Test
  public void testBoundedConditionTimedOut() throws InterruptedException {
    final long start = System.currentTimeMillis();
    final boolean r = Await.bounded(20, () -> false);
    assertFalse(r);
    final long elapsed = System.currentTimeMillis() - start;
    assertTrue("Elapsed " + elapsed, elapsed > 20);
  }
  
  @Test
  public void testBoundedConditionPassed() throws InterruptedException {
    final boolean r = Await.bounded(20, () -> true);
    assertTrue(r);
  }

  @Test
  public void testPerpetualConditionPassed() throws InterruptedException {
    Await.perpetual(() -> true);
    Await.perpetual(10, () -> true);
  }
  
  @Test(expected=TimeoutException.class)
  public void testBoundedTimeoutException() throws InterruptedException, TimeoutException {
    Await.boundedTimeout(20, () -> false);
  }
  
  @Test()
  public void testBoundedTimeoutNoException() throws InterruptedException, TimeoutException {
    Await.boundedTimeout(20, () -> true);
  }

  @Test
  public void testConformance() throws Exception {
    assertUtilityClassWellDefined(Await.class);
  }
}
<commit_msg>Fixed test.<commit_after>package au.com.williamhill.flywheel.util;

import static com.obsidiandynamics.indigo.util.TestSupport.*;
import static junit.framework.TestCase.*;

import java.util.concurrent.*;

import org.junit.*;

public final class AwaitTest {
  @Test(expected=InterruptedException.class)
  public void testInterrupt() throws InterruptedException, TimeoutException {
    Thread.currentThread().interrupt();
    Await.perpetual(20, () -> false);
  }
  
  @Test
  public void testBoundedConditionTimedOut() throws InterruptedException {
    final long start = System.currentTimeMillis();
    final boolean r = Await.bounded(20, () -> false);
    assertFalse(r);
    final long elapsed = System.currentTimeMillis() - start;
    assertTrue("Elapsed " + elapsed, elapsed >= 20);
  }
  
  @Test
  public void testBoundedConditionPassed() throws InterruptedException {
    final boolean r = Await.bounded(20, () -> true);
    assertTrue(r);
  }

  @Test
  public void testPerpetualConditionPassed() throws InterruptedException {
    Await.perpetual(() -> true);
    Await.perpetual(10, () -> true);
  }
  
  @Test(expected=TimeoutException.class)
  public void testBoundedTimeoutException() throws InterruptedException, TimeoutException {
    Await.boundedTimeout(20, () -> false);
  }
  
  @Test()
  public void testBoundedTimeoutNoException() throws InterruptedException, TimeoutException {
    Await.boundedTimeout(20, () -> true);
  }

  @Test
  public void testConformance() throws Exception {
    assertUtilityClassWellDefined(Await.class);
  }
}

{'fraction_non_alphanumeric': 0.11542160949022122, 'fraction_numerical': 0.008977236293683874, 'mean_word_length': 4.351629502572899, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5999026', 'n_tokens_mistral': 940, 'n_tokens_neox': 919, 'n_words': 197}