Skip to content

Troubleshooting

Olga Naumenko edited this page Sep 20, 2023 · 9 revisions

Troubleshooting

Here is the list of known but unsolved UnitTestBot Java problems with workarounds:

JDK 17: successful symbolic executions fail due to failing utility methods

Problem details:

The symbolic execution engine in UnitTestBot Java may generate tests that should pass, but they fail. The reason is that sometimes UnitTestBot Java cannot build an Object assemble model without using Reflection. Reflection methods using setAccessible are forbidden in JDK 17 or later, so the UtUtils methods using setAccessible do not work, and successful executions fail.

See an example in the issue.

Solution:

Add the following keys to the test run configuration:
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.lang.reflect=ALL-UNNAMED

JDK 17: UnitTestBot Java tries to mock unexported packages and creates uncompilable tests

Problem details:

Using JDK 17, UnitTestBot Java tries to create mockStatic(sun.net.util.IPAddressUtil.class) for the code working with network. IPAddressUtill is not exported from JDK module, so the resulting tests are not compilable.

See an example in the issue.

Solution:

Add the following key to the test run configuration:
--add-exports java.base/sun.net.util=ALL-UNNAMED

Clone this wiki locally