Как определить, где класс вызывается - PullRequest
0 голосов
/ 16 апреля 2020

Я получаю следующее сообщение об ошибке при попытке запустить интеграционный тест на JAVA

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.xxx.yyy.itest.RunnerITCase
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.061 s <<< FAILURE! - in com.xxx.yyy.itest.RunnerITCase
[ERROR] initializationError  Time elapsed: 0.001 s  <<< ERROR!
java.lang.NoClassDefFoundError: com/xxx/yyy/template/engine/common/datamodel/Template
Caused by: java.lang.ClassNotFoundException: com.xxx.yyy.template.engine.common.datamodel.Template

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors: 
[ERROR]   RunnerITCase » NoClassDefFound com/xxx/yyy/template/engine/common/datam...
[INFO]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

Как при проверке класса com.xxx.yyy.itest.RunnerITCase я не нахожу любой импорт или вызов для этой библиотеки.

package com.xxx.yyy.itest;

import com.cucumber.listener.Reporter;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;


@RunWith(Cucumber.class)
@CucumberOptions(features = "src/it/resources",
        tags = "~@ignore",
        plugin = {"com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html"},
        glue= "com/allianz/",
        monochrome = true
)
public class RunnerITCase {

    static {
        Logger rootLogger = Logger.getRootLogger();
        rootLogger.setLevel(Level.INFO);
    }

    @BeforeClass
    public static void setUp() {
        assert System.getProperty("environment") != null;
    }

    @AfterClass
    public static void writeExtentReport() throws IOException {
        Files.copy(RunnerITCase.class.getResourceAsStream("/report/extent-config.xml"),
                new File("extent-config.xml").toPath(), StandardCopyOption.REPLACE_EXISTING);
        Reporter.loadXMLConfig("extent-config.xml");
    }

}

Если есть какой-либо способ отследить этот вызов и найти, где именно пытается вызвать во время выполнения?

...