Skip to content

Commit a27bf65

Browse files
committed
Validating that submitted work was executed in daemon thread factory tests
1 parent 3619d4a commit a27bf65

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sdk/common/src/test/java/io/opentelemetry/sdk/internal/DaemonThreadFactoryTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import static org.mockito.Mockito.verify;
1212
import static org.mockito.Mockito.verifyNoInteractions;
1313

14+
import java.util.concurrent.Callable;
1415
import java.util.concurrent.ExecutionException;
1516
import java.util.concurrent.ExecutorService;
1617
import java.util.concurrent.Executors;
@@ -33,7 +34,7 @@ void verifyUncaughtExceptions()
3334
};
3435
ExecutorService service =
3536
Executors.newSingleThreadExecutor(new DaemonThreadFactory("test", delegateFactory));
36-
Runnable runnable =
37+
Callable<Boolean> callable =
3738
() -> {
3839
Thread.UncaughtExceptionHandler uncaughtExceptionHandler =
3940
Thread.currentThread().getUncaughtExceptionHandler();
@@ -53,8 +54,9 @@ void verifyUncaughtExceptions()
5354
IllegalStateException e = new IllegalStateException();
5455
uncaughtExceptionHandler.uncaughtException(threadMock, e);
5556
verify(defaultHandler).uncaughtException(threadMock, e);
57+
return true;
5658
};
5759

58-
service.submit(runnable).get(5, TimeUnit.SECONDS);
60+
assertThat(service.submit(callable).get(5, TimeUnit.SECONDS)).isTrue();
5961
}
6062
}

0 commit comments

Comments
 (0)