package com.lmax.disruptor;

import com.lmax.disruptor.support.DummySequenceBarrier;
import org.junit.Test;

import java.util.concurrent.TimeUnit;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

public class LiteTimeoutBlockingWaitStrategyTest
{
    @Test
    public void shouldTimeoutWaitFor() throws Exception
    {
        final SequenceBarrier sequenceBarrier = new DummySequenceBarrier();

        long theTimeout = 500;
        LiteTimeoutBlockingWaitStrategy waitStrategy = new LiteTimeoutBlockingWaitStrategy(theTimeout, TimeUnit.MILLISECONDS);
        Sequence cursor = new Sequence(5);
        Sequence dependent = cursor;

        long t0 = System.currentTimeMillis();

        try
        {
            waitStrategy.waitFor(6, cursor, dependent, sequenceBarrier);
            fail("TimeoutException should have been thrown");
        }
        catch (TimeoutException e)
        {
        }

        long t1 = System.currentTimeMillis();

        long timeWaiting = t1 - t0;

        assertTrue(timeWaiting >= theTimeout);
    }
}

@@ -99,14 +99,26 @@
 nit.
+jupiter.api.
 Test;%0A
-
 %0Aimp
@@ -177,22 +177,38 @@
 g.junit.
+jupiter.api.
 Assert
+ions
 .assertT
@@ -236,22 +236,38 @@
 g.junit.
+jupiter.api.
 Assert
+ions
 .fail;%0A%0A

Rewrite LiteTimeoutBlockingWaitStrategyTest in spirit of JUnit 5