36 |
|
import java.util.function.BiFunction; |
37 |
|
import java.util.function.Consumer; |
38 |
|
import java.util.function.Function; |
39 |
+ |
import java.util.function.Predicate; |
40 |
|
import java.util.function.Supplier; |
41 |
|
|
42 |
|
import junit.framework.Test; |
3704 |
|
if (!testImplementationDetails) return; |
3705 |
|
Function<Method, String> toSignature = |
3706 |
|
(method) -> method.getName() + Arrays.toString(method.getParameterTypes()); |
3707 |
+ |
Predicate<Method> isNotStatic = |
3708 |
+ |
(method) -> (method.getModifiers() & Modifier.STATIC) == 0; |
3709 |
|
List<Method> minimalMethods = |
3710 |
|
Stream.of(Object.class, CompletionStage.class) |
3711 |
|
.map((klazz) -> Stream.of(klazz.getMethods())) |
3712 |
|
.reduce(Stream::concat) |
3713 |
|
.orElseGet(Stream::empty) |
3714 |
< |
.filter((method) -> (method.getModifiers() & Modifier.STATIC) == 0) |
3714 |
> |
.filter(isNotStatic) |
3715 |
|
.collect(Collectors.toList()); |
3716 |
|
// Methods from CompletableFuture permitted NOT to throw UOE |
3717 |
|
String[] signatureWhitelist = { |
3725 |
|
Stream.of(signatureWhitelist)) |
3726 |
|
.collect(Collectors.toSet()); |
3727 |
|
List<Method> allMethods = Stream.of(CompletableFuture.class.getMethods()) |
3728 |
< |
.filter((method) -> (method.getModifiers() & Modifier.STATIC) == 0) |
3728 |
> |
.filter(isNotStatic) |
3729 |
|
.filter((method) -> !permittedMethodSignatures.contains(toSignature.apply(method))) |
3730 |
|
.collect(Collectors.toList()); |
3731 |
|
|