// Path: utility/src/main/java/com/comcast/viper/flume2storm/utility/Constants.java
// public interface Constants {
//   /**
//    * The maximum unsigned short value
//    */
//   int MAX_UNSIGNED_SHORT = 0xFFFF;
// }


import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.comcast.viper.flume2storm.utility.Constants;
    final Thread thread = new TestThread();
    thread.start();
    LOG.debug("Waiting for condition (thread terminated)...");
    TestUtils.waitFor(new MyTestCondition(), DURATION / 2);
  }

  /**
   * Test {@link TestUtils#waitFor(TestCondition, int)} success
   * 
   * @throws InterruptedException
   *           If interrupted
   */
  @Test
  public void testTimeoutSuccess() throws InterruptedException {
    final Thread thread = new TestThread();
    thread.start();
    LOG.debug("Waiting for condition (thread terminated)...");
    final boolean result = TestUtils.waitFor(new MyTestCondition(), DURATION * 2);
    LOG.debug("Done waiting");
    Assert.assertTrue(result);
    thread.join();
  }

  /**
   * Test {@link TestUtils#getAvailablePort()}
   */
  @Test
  public void testGetAvailablePort() {
    int port1 = TestUtils.getAvailablePort();
    Assert.assertTrue(port1 > 0);
// Path: utility/src/main/java/com/comcast/viper/flume2storm/utility/Constants.java
// public interface Constants {
//   /**
//    * The maximum unsigned short value
//    */
//   int MAX_UNSIGNED_SHORT = 0xFFFF;
// }


// Path: utility/src/test/java/com/comcast/viper/flume2storm/utility/test/TestUtilsTest.java
import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.comcast.viper.flume2storm.utility.Constants;

    final Thread thread = new TestThread();
    thread.start();
    LOG.debug("Waiting for condition (thread terminated)...");
    TestUtils.waitFor(new MyTestCondition(), DURATION / 2);
  }

  /**
   * Test {@link TestUtils#waitFor(TestCondition, int)} success
   * 
   * @throws InterruptedException
   *           If interrupted
   */
  @Test
  public void testTimeoutSuccess() throws InterruptedException {
    final Thread thread = new TestThread();
    thread.start();
    LOG.debug("Waiting for condition (thread terminated)...");
    final boolean result = TestUtils.waitFor(new MyTestCondition(), DURATION * 2);
    LOG.debug("Done waiting");
    Assert.assertTrue(result);
    thread.join();
  }

  /**
   * Test {@link TestUtils#getAvailablePort()}
   */
  @Test
  public void testGetAvailablePort() {
    int port1 = TestUtils.getAvailablePort();
    Assert.assertTrue(port1 > 0);
    Assert.assertTrue(port1 < Constants.MAX_UNSIGNED_SHORT);