### Question:
IndexUpgraderWrapper implements AutoCloseable { public void upgradeIndex( Path indexPath ) throws Throwable { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if ( mainMethod == null ) { luceneLoader = jarLoaderSupplier.get(); Class upgrader = luceneLoader.loadEmbeddedClass( LUCENE_INDEX_UPGRADER_CLASS_NAME ); MethodHandles.Lookup lookup = MethodHandles.lookup(); mainMethod = lookup.findStatic( upgrader, "main", MethodType.methodType( void.class, String[].class ) ); } Thread.currentThread().setContextClassLoader( luceneLoader.getJarsClassLoader() ); mainMethod.invokeExact( new String[]{indexPath.toString()} ); } finally { Thread.currentThread().setContextClassLoader( contextClassLoader ); } } IndexUpgraderWrapper( Supplier<EmbeddedJarLoader> jarLoaderSupplier ); void upgradeIndex( Path indexPath ); @Override void close();  }### Answer:
@Test public void indexUpgraderInvokesLuceneMigrator() throws Throwable { IndexUpgraderWrapper upgrader = getIndexUpgrader( createJarLoader() ); UpgraderStub.resetInvocationMark(); upgrader.upgradeIndex( Paths.get( "some" ) ); assertTrue( UpgraderStub.getInvocationMark() ); }