Test classes not visible within QuarkusUnitTest?

13 views
Skip to first unread message

William Burke

unread,
Nov 12, 2025, 5:04:46 PM (3 days ago) Nov 12
to Quarkus Development mailing list
In the following code, Pojo is a test class.  I get class not found exceptions when I run the code.   Is there some annotation that allows me to run the test within the test's classloader.

    @RegisterExtension
    public static QuarkusUnitTest test = new QuarkusUnitTest()
            .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
                    .addClasses(MyChatService.class));

    @Test
    public void testChat() {
        Pojo pojo = new Pojo();

--
Bill Burke
IBM

Sanne Grinovero

unread,
Nov 12, 2025, 5:25:38 PM (3 days ago) Nov 12
to quark...@googlegroups.com

You should add the Pojo.class into the archive, together with MyChatService.class and anything else your test is needing. The purpose of using the Shrinkwrap & QuarkusUnitTest utility is to define an isolated set of classes - isolated from the rest of the code, so you can choose what exactly gets included and what not.
Are you sure you want to use QuarkusUnitTest?

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/quarkus-dev/CAL%3DE%3DjRKcLgJn%3DbH8h8dRW1AOSiToYKs8q3mt62e8AKCimCC%3Dw%40mail.gmail.com.

William Burke

unread,
Nov 12, 2025, 8:38:01 PM (3 days ago) Nov 12
to quark...@googlegroups.com
Yeah, I have test scoped dependencies I need to reference too so that doesn't work.  Is there something like QuarkusUnitTest?  I'm trying to run tests within a deployment module of an extension.



--
Bill Burke
IBM

Georgios Andrianakis

unread,
Nov 13, 2025, 1:59:12 AM (2 days ago) Nov 13
to quark...@googlegroups.com
Not that I remember

--

William Burke

unread,
Nov 13, 2025, 5:57:56 AM (2 days ago) Nov 13
to quark...@googlegroups.com
Actually, NVM...makes sense why other classes would be excluded.  I was trying to prototype some stuff in test.
--
Bill Burke
IBM
Reply all
Reply to author
Forward
0 new messages