Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@QuarkusComponentTest not working with @Nested classes in Quarkus 3.19 #47195

Closed
RayanArgolo03 opened this issue Apr 5, 2025 · 3 comments
Closed
Labels
area/testing kind/bug Something isn't working triage/needs-feedback We are waiting for feedback.

Comments

@RayanArgolo03
Copy link

RayanArgolo03 commented Apr 5, 2025

Describe the bug

My code

@QuarkusComponentTest
@ExtendWith(MockitoExtension.class)
@DisplayName("--- Authentication service tests ---")
public class AuthenticationServiceTest {

    @Inject
    AuthenticationService service;

    @InjectMock
    CredentialRepository credentialRepository;

    @InjectMock
    ForgotPasswordRepository forgotPasswordRepository;

    @Spy
    CredentialMapper credentialMapper;

    @Spy
    ForgotPasswordMapper forgotPasswordMapper;

    Validator hibernateValidator = Validation.buildDefaultValidatorFactory().getValidator();

    @Nested
    @DisplayName("--- Persist credential tests ")
    class PersistCredentialTests {

        @Test
        @DisplayName("Should be throw ConstraintViolationException when email is null")
        void givenPersistCredential_whenEmailIsNull_thenThrowConstraintViolationException() {

            final String password = "#Rayan12";
            final CredentialRequest request = new CredentialRequest(null, password);

            final Set<ConstraintViolation<CredentialRequest>> violations = hibernateValidator.validate(request);
            final String message = violations.iterator().next().getMessage();

            final String expectedMessage = "Email required!";
            final int expectedViolations = 1;

            assertEquals(expectedViolations, violations.size());
            assertEquals(expectedMessage, message);

        }
}

Exception

`java.lang.IllegalStateException: No component classes to test

at io.quarkus.test.component.QuarkusComponentTestExtension.initArcContainer(QuarkusComponentTestExtension.java:521)
at io.quarkus.test.component.QuarkusComponentTestExtension.buildContainer(QuarkusComponentTestExtension.java:372)
at io.quarkus.test.component.QuarkusComponentTestExtension.beforeAll(QuarkusComponentTestExtension.java:220)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

`

Image

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

19

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

@RayanArgolo03 RayanArgolo03 added the kind/bug Something isn't working label Apr 5, 2025
@geoand
Copy link
Contributor

geoand commented Apr 7, 2025

Is this also an issue with Quarkus 3.20 and 3.21?

cc @mkouba

@geoand geoand added the triage/needs-feedback We are waiting for feedback. label Apr 7, 2025
@mkouba
Copy link
Contributor

mkouba commented Apr 7, 2025

The basic support for nested test classes was added in 3.21.0.CR1, see also #46487.

@mkouba mkouba closed this as not planned Won't fix, can't repro, duplicate, stale Apr 7, 2025
@RayanArgolo03
Copy link
Author

The basic support for nested test classes was added in 3.21.0.CR1, see also #46487.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing kind/bug Something isn't working triage/needs-feedback We are waiting for feedback.
Projects
None yet
Development

No branches or pull requests

3 participants