ERROR FunctionalMockStatement - Cannot use Mockito on class petstore.repository.TXContext due to failed class initialization: Could not initialize class petstore.logging.LogFactory
all generation tests only contains one assertion on: no meaningful assertion but class not found
public void test0() throws Throwable {
PetStoreService petStoreService0 = new PetStoreService ();
Instant instant0 = MockInstant.now();
Date date0 = Date.from(instant0);
// Undeclared exception!
try {
onlineUserService0.getPetStoreList(date0, date0);
fail("Expecting exception: NoClassDefFoundError");
} catch(NoClassDefFoundError e) {
//
// Could not initialize class testdata.PetStoreDataService
//
}
}
Context
when i tried generate test in our code base, the mocking dependencies fails on the
private static final
fields like logger assets...reporting
Cannot use Mockito on xxxxx due to failed class initialization:
maybe we need mockito-inline support? but how to configure it correctly?
Steps to Reproduce
private static final
fields external dependenciesEvoSuite Arguments
this is the gradle command setting
def command = [ 'evosuite.jar', '-class', className, '-Dno_runtime_dependency=true', "-Dsearch_budget=20", "-Dtest_dir=${generatedTestDir}", "-junit=5", "-Dhandle_static_fields=false", "-DCP_file_path=${classpathFile.absolutePath}" ]
Current Result
ERROR FunctionalMockStatement - Cannot use Mockito on class petstore.repository.TXContext due to failed class initialization: Could not initialize class petstore.logging.LogFactory
all generation tests only contains one assertion on: no meaningful assertion but class not found
Expected result
mock create successful, and test generation ok