Package com.crawljax.core

Source Code of com.crawljax.core.ExitNotifierTest

package com.crawljax.core;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

import org.junit.Test;

import com.crawljax.core.ExitNotifier.ExitStatus;

public class ExitNotifierTest {

  private ExitNotifier notifier;

  @Test(timeout = 2000)
  public void whenMaximumStatesReachedItExists() throws InterruptedException {
    notifier = new ExitNotifier(2);
    notifier.incrementNumberOfStates();
    notifier.incrementNumberOfStates();
    ExitStatus reason = notifier.awaitTermination();
    assertThat(reason, is(ExitStatus.MAX_STATES));

  }

  @Test(timeout = 2000)
  public void whenNoStateLimitItDoesntTerminate() throws InterruptedException {
    notifier = new ExitNotifier(0);
    notifier.incrementNumberOfStates();
    notifier.incrementNumberOfStates();
    assertThat(notifier.isExitCalled(), is(false));
  }

}
TOP

Related Classes of com.crawljax.core.ExitNotifierTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.