in junit4/src/main/java/com/spotify/feline/FelineRunListener.java [44:75]
static {
// Install when JUnit Runner loads this class
Feline.addConsumerLast(
blockingCall -> {
boolean prevBlocking = false;
boolean ignore = false;
for (final StackTraceElement line : Thread.currentThread().getStackTrace()) {
if (line.getClassName().equals("java.util.concurrent.CompletableFuture")
&& (line.getMethodName().equals("get") || line.getMethodName().equals("join"))) {
prevBlocking = true;
} else {
if (prevBlocking) {
try {
final Method method = BytecodeUtils.getMethod(line);
if (method.getAnnotation(IgnoreBlocking.class) != null) {
ignore = true;
break;
}
} catch (Exception ignored) {
// exception ignored
}
}
prevBlocking = false;
}
}
if (!ignore) {
throw new RuntimeException("blocking call at " + blockingCall);
}
});
}