/** * 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())); } }