### Question:
MavenIndexManager implements ArchivaIndexManager { @Override public void pack( final ArchivaIndexingContext context ) throws IndexUpdateFailedException { executeUpdateFunction( context, indexingContext -> { try { IndexPackingRequest request = new IndexPackingRequest( indexingContext, indexingContext.acquireIndexSearcher( ).getIndexReader( ), indexingContext.getIndexDirectoryFile( ) ); indexPacker.packIndex( request ); indexingContext.updateTimestamp( true ); } catch ( IOException e ) { log.error( "IOException while packing index of context " + context.getId( ) + ( StringUtils.isNotEmpty( e.getMessage( ) ) ? ": " + e.getMessage( ) : "" ) ); throw new IndexUpdateFailedException( "IOException during update of " + context.getId( ), e ); } } ); }  static IndexingContext getMvnContext( ArchivaIndexingContext context ); @Override void pack( final ArchivaIndexingContext context ); @Override void scan(final ArchivaIndexingContext context); @Override void update(final ArchivaIndexingContext context, final boolean fullUpdate); @Override void addArtifactsToIndex( final ArchivaIndexingContext context, final Collection<URI> artifactReference ); @Override void removeArtifactsFromIndex( ArchivaIndexingContext context, Collection<URI> artifactReference ); @Override boolean supportsRepository( RepositoryType type ); @Override ArchivaIndexingContext createContext( Repository repository ); @Override ArchivaIndexingContext reset(ArchivaIndexingContext context); @Override ArchivaIndexingContext move(ArchivaIndexingContext context, Repository repo); @Override void updateLocalIndexPath(Repository repo); @Override ArchivaIndexingContext mergeContexts(Repository destinationRepo, List<ArchivaIndexingContext> contexts,
                                                boolean packIndex);  }### Answer:
@Test public void pack() throws Exception { createTestContext(); Path destDir = repository.getRoot().getFilePath().resolve("org/apache/archiva/archiva-webapp/1.0"); Path srcDir = Paths.get("src/test/maven-search-test-repo/org/apache/archiva/archiva-webapp/1.0"); org.apache.commons.io.FileUtils.copyDirectory(srcDir.toFile(),destDir.toFile()); mavenIndexManager.scan(ctx); mavenIndexManager.pack(ctx); assertTrue(Files.list(indexPath).filter(path -> { try { return path.getFileName().toString().endsWith(".gz") && Files.size(path) > 0; } catch (IOException e) { return false; } }).findAny().isPresent()); }