|
1 |
| -package org.jooq.lambda; |
2 |
| - |
3 |
| -import java.util.concurrent.CompletableFuture; |
4 |
| -import java.util.concurrent.ForkJoinPool; |
5 |
| -import java.util.concurrent.atomic.AtomicBoolean; |
6 |
| -import org.junit.Assert; |
7 |
| -import org.junit.Test; |
8 |
| - |
9 |
| -/** |
10 |
| - * |
11 |
| - */ |
12 |
| -public class BlockingTest { |
13 |
| - |
14 |
| - private static ForkJoinPool pool = new ForkJoinPool(1); |
15 |
| - |
16 |
| - /** |
17 |
| - * Test that {@link Blocking#runnable(java.lang.Runnable) } executes the given runnable. |
18 |
| - */ |
19 |
| - @Test |
20 |
| - public void testRunnable_run() { |
21 |
| - AtomicBoolean executed = new AtomicBoolean(false); |
22 |
| - |
23 |
| - Runnable runnable = Blocking.runnable(() -> executed.set(true)); |
24 |
| - |
25 |
| - CompletableFuture.runAsync(runnable, pool) |
26 |
| - .join(); |
27 |
| - Assert.assertTrue("The given runnable has not been executed", executed.get()); |
28 |
| - } |
29 |
| - |
30 |
| - |
31 |
| -} |
| 1 | +package org.jooq.lambda; |
| 2 | + |
| 3 | +import java.util.concurrent.CompletableFuture; |
| 4 | +import java.util.concurrent.ForkJoinPool; |
| 5 | +import java.util.concurrent.atomic.AtomicBoolean; |
| 6 | +import org.junit.Assert; |
| 7 | +import org.junit.Test; |
| 8 | + |
| 9 | +/** |
| 10 | + * |
| 11 | + */ |
| 12 | +public class BlockingTest { |
| 13 | + |
| 14 | + private static ForkJoinPool pool = new ForkJoinPool(1); |
| 15 | + |
| 16 | + /** |
| 17 | + * Test that {@link Blocking#runnable(java.lang.Runnable) } executes the given runnable. |
| 18 | + */ |
| 19 | + @Test |
| 20 | + public void testRunnable_run() { |
| 21 | + AtomicBoolean executed = new AtomicBoolean(false); |
| 22 | + |
| 23 | + Runnable runnable = Blocking.runnable(() -> executed.set(true)); |
| 24 | + |
| 25 | + CompletableFuture.runAsync(runnable, pool) |
| 26 | + .join(); |
| 27 | + Assert.assertTrue("The given runnable has not been executed", executed.get()); |
| 28 | + } |
| 29 | + |
| 30 | + |
| 31 | +} |
0 commit comments