Add TimeLimiter test.

This commit is contained in:
Derry Hamilton 2019-06-18 14:46:21 +01:00
parent 4fe30a196c
commit ff157e6a59

View file

@ -0,0 +1,25 @@
package com.rasilon.ujetl;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.MethodOrderer.Alphanumeric;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
public class TestTimeLimiter {
@Test
public void test001Limiter() {
try {
TimeLimiter hardLimit = new TimeLimiter(1,false);
hardLimit.start();
Thread.sleep(10000);
fail("Sleep wasn't interrupted by the limiter!");
} catch(Exception e) {
// Pass
}
}
}