You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
UnitTestBot generates a test suite that uses several Mockito API components. However, no suitable Mockito dependency is present or is added by the plugin.
Use the UnitTestBot IntelliJ IDEA plugin to generate tests for the com.lyn.web.controller.GoodsController.search(String, Pageable) method. Leave all UnitTestBot settings at their defaults, other than selecting this one method to generate tests for.
Expected behavior
UnitTestBot should have generated one or more tests that are ready to compile and run in the IDE.
Actual behavior
UnitTestBot generated a test class with multiple test methods:
However, this test class fails to compile and run in IntelliJ IDEA. Attempting to do so produces the following compilation errors:
/path/to/project/lyn-parents/lyn-web/utbot_tests/com/lyn/web/controller/GoodsControllerTest.java:15:19
java: cannot find symbol
symbol: class MockedConstruction
location: package org.mockito
/path/to/project/lyn-parents/lyn-web/utbot_tests/com/lyn/web/controller/GoodsControllerTest.java:16:38
java: package org.mockito.MockedConstruction does not exist
/path/to/project/lyn-parents/lyn-web/utbot_tests/com/lyn/web/controller/GoodsControllerTest.java:17:19
java: cannot find symbol
symbol: class MockedStatic
location: package org.mockito
/path/to/project/lyn-parents/lyn-web/utbot_tests/com/lyn/web/controller/GoodsControllerTest.java:25
java: cannot find symbol
symbol: static openMocks
location: class
/path/to/project/lyn-parents/lyn-web/utbot_tests/com/lyn/web/controller/GoodsControllerTest.java:59:9
java: cannot find symbol
symbol: class MockedConstruction
location: class com.lyn.web.controller.GoodsControllerTest
/path/to/project/lyn-parents/lyn-web/utbot_tests/com/lyn/web/controller/GoodsControllerTest.java:60:9
java: cannot find symbol
symbol: class MockedStatic
location: class com.lyn.web.controller.GoodsControllerTest
/path/to/project/lyn-parents/lyn-web/utbot_tests/com/lyn/web/controller/GoodsControllerTest.java:62:34
java: cannot find symbol
symbol: method mockConstruction(java.lang.Class<org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder>,(NativeSea[...]->{ })
location: class com.lyn.web.controller.GoodsControllerTest
/path/to/project/lyn-parents/lyn-web/utbot_tests/com/lyn/web/controller/GoodsControllerTest.java:62:139
java: cannot find symbol
symbol: class Context
location: class com.lyn.web.controller.GoodsControllerTest
/path/to/project/lyn-parents/lyn-web/utbot_tests/com/lyn/web/controller/GoodsControllerTest.java:64:28
java: cannot find symbol
symbol: method mockStatic(java.lang.Class<org.elasticsearch.index.query.QueryBuilders>)
location: class com.lyn.web.controller.GoodsControllerTest
/path/to/project/lyn-parents/lyn-web/utbot_tests/com/lyn/web/controller/GoodsControllerTest.java:111:28
java: cannot find symbol
symbol: method openMocks(com.lyn.web.controller.GoodsControllerTest)
location: class com.lyn.web.controller.GoodsControllerTest
The UnitTestBot IDE plugin already modifies pom.xml files to add JUnit dependencies as needed. It should add a suitable Mockito dependency as well.
Environment
IntelliJ IDEA 2023.2.6 (Ultimate Edition)
JetBrains UnitTestBot plugin version 2023.10
All UnitTestBot plugin settings were left at their default values.
The text was updated successfully, but these errors were encountered:
Description
UnitTestBot generates a test suite that uses several Mockito API components. However, no suitable Mockito dependency is present or is added by the plugin.
To Reproduce
Steps to reproduce the behavior:
Check out https://github.com/atn-lyn/lyn-parents. For the issue reported here, the current
master
head revision of this repository was atn-lyn/lyn-parents@3ff5ce7, but it is not clear whether this issue is sensitive to this specific revision.Add the following to
pom.xml
to explicitly select Java 1.8:Open this project in IntelliJ IDEA and link its
pom.xml
, thereby making this a Maven project.In the IntelliJ IDEA Project Settings, select a Java 1.8 SDK.
If this
import
line inlyn-web/src/main/java/com/lyn/web/controller/GoodsController.java
fails to resolve in the IDE, then delete it.Use the UnitTestBot IntelliJ IDEA plugin to generate tests for the
com.lyn.web.controller.GoodsController.search(String, Pageable)
method. Leave all UnitTestBot settings at their defaults, other than selecting this one method to generate tests for.Expected behavior
UnitTestBot should have generated one or more tests that are ready to compile and run in the IDE.
Actual behavior
UnitTestBot generated a test class with multiple test methods:
Generated `GoodsControllerTest.java`
However, this test class fails to compile and run in IntelliJ IDEA. Attempting to do so produces the following compilation errors:
The UnitTestBot IDE plugin already modifies
pom.xml
files to add JUnit dependencies as needed. It should add a suitable Mockito dependency as well.Environment
The text was updated successfully, but these errors were encountered: