79784166

Date: 2025-10-07 01:44:14
Score: 1
Natty:
Report link

I have just resolved this by adding the related dependencies that the generated test sources need to resolve the imports, in the pom. The reason it cannot resolve is because the dependencies are not available at compile-time and usually (when configured) are available only during test scope. In this case, it needed @Test and @SpringBootTest imports. If you add the following using compile scope then the generated tests should have access to them at compile-time:

<!-- Compile-time access to test annotations -->
<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-api</artifactId>
    <version>latest or non-conflicting version</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-test</artifactId>
    <version>latest or non-conflicting version</version>
    <scope>compile</scope>
</dependency>
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Test
  • User mentioned (0): @SpringBootTest
  • Low reputation (1):
Posted by: Syed Ali