Home | History | Annotate | Download | only in timeout
      1 package test.timeout;
      2 
      3 import org.testng.annotations.Test;
      4 
      5 public class InvocationTimeOutSampleTest {
      6 
      7   @Test(invocationCount = 5, invocationTimeOut = 2_000)
      8   public void shouldPass() {
      9     try {
     10       Thread.sleep(250);
     11     } catch (InterruptedException handled) {
     12       Thread.currentThread().interrupt();
     13     }
     14   }
     15 
     16   @Test(invocationCount = 5, invocationTimeOut = 1_000)
     17   public void shouldFail() {
     18     try {
     19       Thread.sleep(250);
     20     } catch (InterruptedException handled) {
     21       Thread.currentThread().interrupt();
     22     }
     23   }
     24 }
     25