/** * Checks if the specified path contains any class file. * @param path * the path to check * @return * <code>true</code> if the path contains at least one class file */ private boolean containsClassFiles(final Path path) { return runUnchecked(() -> Files.list(path).anyMatch(this::isClassFile)); }
/** * Initializes the specified context in the provided classloader, given the classloader is a different one than * of the specified context * @param ctx * the context that should be transferred to the other classloader * @param cl * the classloader whose context should be initialized */ public static void init(final TestExecutionContext ctx, final ClassLoader cl) { //avoid overwriting the context in the same classloader if (!Objects.equals(ctx.getClass().getClassLoader(), cl)) { //NOSONAR runUnchecked(() -> cl.loadClass(ctx.getClass().getName()) .getMethod("init", Properties.class, Properties.class) .invoke(null, ctx.getInput(), ctx.getEnv())); } }