private void analyzeTestClasses(TestAnnotationAnalyzer analyzer) throws MojoExecutionException {
        if (! Files.exists(testClassesDirectory())) return;

        try (Stream<Path> files = Files.walk(testClassesDirectory())) {
            files
                    .filter(f -> f.toString().endsWith(".class"))
                    .forEach(analyzer::analyzeClass);
        } catch (Exception e) {
            throw new MojoExecutionException("Failed to analyze test classes: " + e.getMessage(), e);
        }
    }
Generates a test descriptor file based on content of the compiled test classes

@author bjorncs
vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/GenerateTestDescriptorMojo.java