UnitTestBot / UTBotJava

Automated unit test generation and precise code analysis for Java
Apache License 2.0
136 stars 43 forks source link

Building Generated Tests Under JDK 17 Files Due To Modules Export Error #2709

Open mrother-stoneriver opened 11 months ago

mrother-stoneriver commented 11 months ago

Description

After generating unit tests for existing java classes, the unit tests fail to build to java modules export error.

To Reproduce

Steps to reproduce the behavior:

Have a java class which has a java.util.Date instance variable. Generated test class has the following:

import sun.util.calendar.JulianCalendar;

which when compiles gives the following error

error: package sun.util.calendar is not visible [ERROR] (package sun.util.calendar is declared in module java.base, which does not export it)

Expected behavior

Generated tests compile.

Actual behavior

Tests failed compilation.

Visual proofs (screenshots, logs, images)

Example:

public void testFail_errors() {
// Couldn't generate some tests. List of errors:
//
// 684 occurrences of:
// Concrete execution failed
}

Environment

Substitute this text with an information that can help us to recreate the environment. For instance, specify Java version, test framework with a version (JUnit, TestNG...), Mockito configuration (packages, classes, statics), were the test parametrized or not and so on.

Additional context

Add any other context about the problem here.