推奨事項の種類: 例外 / アサーション エラー
設定可能: いいえ
フィルター カテゴリ: 例外 / アサーション エラー
この推奨事項は、実行中にテストが失敗した場合、または例外がスローされた場合に表示されます。
@Test public void testFactorial2() throws Throwable { // Given Example underTest = new Example(); // When int n = 5; 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(10, TimeUnit.MICROSECONDS); // Then assertEquals(120, result.get()); } |