Fix test expectation
Change-Id: Ic5fedec1b1760841498bcd84007e9f84d5adecf4
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/jdk11/ChannelSetTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/jdk11/ChannelSetTest.java
index 91549ff..cc4bbc3 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/jdk11/ChannelSetTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/jdk11/ChannelSetTest.java
@@ -31,6 +31,7 @@
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.Future;
import org.junit.Test;
@@ -52,6 +53,7 @@
"bytes read: 11",
"String read: Hello World",
"bytes read: 11",
+ "String read: Hello World",
"unsupported");
private static final String EXPECTED_RESULT_DESUGARING_PLATFORM_FILE_SYSTEM =
StringUtils.lines(
@@ -175,12 +177,20 @@
pathWrapper.getFileSystem().provider().newFileChannel(pathWrapper, openOptions)) {
readFromChannel(channel, hello.length());
}
+ ExecutorService executor;
+ try {
+ executor = ForkJoinPool.commonPool();
+ } catch (Throwable t) {
+ // ForkJoinPool is not entirely supported below Android 5.
+ System.out.println("unsupported");
+ return;
+ }
try {
try (AsynchronousFileChannel channel =
pathWrapper
.getFileSystem()
.provider()
- .newAsynchronousFileChannel(pathWrapper, openOptions, ForkJoinPool.commonPool())) {
+ .newAsynchronousFileChannel(pathWrapper, openOptions, executor)) {
ByteBuffer byteBuffer = ByteBuffer.allocate(hello.length());
Future<Integer> readFuture = channel.read(byteBuffer, 0);
// We force the future to await here with get().