Details
Recommendation type: Timeout
Configurable: Yes
Filter category: Exceptions / Assertion Failures
Description
UTA displays this recommendation when the time limit for executing a set of tests is exceeded.
Example
@Test(timeout = 1000) public void testFactorial() throws Throwable { // Given Example underTest = new Example(); // When int n = 10; AtomicInteger result = new AtomicInteger(); CountDownLatch latch = new CountDownLatch(1); new Thread(new Runnable() { @Override public void run() { try { result.set(underTest.factorial(n)); } catch (Exception e) { e.printStackTrace(); } finally { latch.countDown(); } } }); latch.await(); // Then assertEquals(3628800, result.get()); }