Хочу переопределить Listener

Идея такая: пишем свой класс(Junit5Utils) на основе AllureJunit5, в котором переписываем метод interceptAfterAllMethod, чтобы при ошибке к тесту прикручивался скриншот. Но программа этот класс почему-то не видит.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <groupId>ru.viktor</groupId>
  <artifactId>HWArcadiy31</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
    <properties>
        <projectEncoding>UTF-8</projectEncoding>
        <javaVersion>1.8</javaVersion>
    
        <project.build.sourceEncoding>${projectEncoding}</project.build.sourceEncoding>
        <project.reporting.outputEncoding>${projectEncoding}</project.reporting.outputEncoding>
        <maven.compiler.source>${javaVersion}</maven.compiler.source>
        <maven.compiler.target>${javaVersion}</maven.compiler.target>
    
        <junit.jupiter.version>5.6.2</junit.jupiter.version>
        <selenium.version>3.141.59</selenium.version>
        <maven.surefire.plugin.version>2.22.2</maven.surefire.plugin.version>   
        <aspectj.version>1.8.10</aspectj.version>
        <allure.junit5.version>2.13.2</allure.junit5.version>       
        <allure.maven.version>2.10.0</allure.maven.version>
        <surefire.provider.version>1.2.0</surefire.provider.version>
        <aspectj.version>1.9.4</aspectj.version>
    </properties>
    
     <dependencies>
        <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.jupiter.version}</version>
        </dependency>
           
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>${selenium.version}</version>
        </dependency>
        
        <!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-junit5 -->
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-junit5</artifactId>
            <version>${allure.junit5.version}</version>
        </dependency>
        
        <!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-surefire-provider -->
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-surefire-provider</artifactId><!-- Библиотека, позволяющая Maven Surfire Plugin понимать команды junit5-->
            <version>${surefire.provider.version}</version>
        </dependency>   

         <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId><!-- Подключаем при использовании junit5, тк он новый и работает не везде -->
            <version>${junit.jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        
    </dependencies>
  
  <build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
                <configuration>
                    <testFailureIgnore>true</testFailureIgnore>
                    <argLine>
                        -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                    </argLine>
                    <properties>
                        <property>
                            <name>listener</name>
                            <value>ru.viktor.framework.utils.Junit5Utils</value>
                        </property>
                    </properties>
                    <systemPropertyVariables>
                        <allure.results.directory>${project.build.directory}/reports/allure-results</allure.results.directory>                   
                    </systemPropertyVariables>
                    
                    <systemProperties>
                        <property>
                            <name>junit.jupiter.extensions.autodetection.enabled</name>
                            <value>true</value>
                        </property>
                    </systemProperties>
                        
                </configuration>
                  <dependencies>
                    <!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>  
            </plugin>
            
             <plugin>
                <!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-maven -->
                <groupId>io.qameta.allure</groupId>
                <artifactId>allure-maven</artifactId>
                <version>${allure.maven.version}</version>
                <configuration>
                <reportVersion>${allure.maven.version}</reportVersion>
                    <resultsDirectory>${project.build.directory}/reports/allure-results</resultsDirectory>
                    <reportDirectory>${project.build.directory}/reports/allure-reports</reportDirectory>
                </configuration>
            </plugin> 
            
        </plugins>
    </build>
</project>

Класс Junit5Utils

        public class Junit5Utils extends AllureJunit5{
    
    @Override
    public void interceptAfterAllMethod(
            final Invocation<Void> invocation,
            final ReflectiveInvocationContext<Method> invocationContext,
            final ExtensionContext extensionContext) throws Throwable {
        processFixture(TEAR_DOWN, invocation, invocationContext, extensionContext);
        addScreenshot();
    }
    
      @Attachment(value = "screenshot", type = "image/png")
    public static byte[] addScreenshot() {
        return ((TakesScreenshot) DriverManager.getDriver()).getScreenshotAs(OutputType.BYTES);   
    }
}

Ответы (0 шт):