answering my own question...
the closest I got to what I was looking for was described here:
I adapted my example to be:
public class MyProfile implements QuarkusTestProfile {
@Override
public Set<Class<?>> getEnabledAlternatives() {
return Set.of(MockBean1.class, MockBean2.class, MockBean3.class);
}
}
@QuarkusTest
@TestProfile(MyProfile.class)
public class MockTestCase {
@Inject
Intf1 bean1;
@Inject
Bean3 bean3;
@Test
public void testPerTestMock() {
Assertions.assertEquals("Xm1-Ym2", bean1.m1());
Assertions.assertEquals("Zm3-Ym2", bean3.m3());
}
}
the only drawback was that I had to separate the normal test (i.e. not mocked) and the mocked test (above), because the TestProfile is expressed at the type level only.
it also relies on true cdi injection, as opposed to QuarkusMock.installMockForType(), which underneath only swaps out the bean delegate to be the mock. this means that if a new client proxy is created for the same bean (may be in the context of another injection point), it would still point to the original delegate, not the mock.
one idea for improvement: it is a bit cumbersome to create a class just to specify a list of alternative classes. something like this could be nice:
@QuarkusTest
@MockAlternatives({MockBean1.class, MockBean2.class})
public class MockTestCase {
...
another idea would be to allow this at the method level. for instance:
@Test
@MockAlternatives({MockBean1.class, MockBean2.class})
public void test12() {
...
}
@Test
@MockAlternatives({MockBean3.class})
public void test3() {
...
}
this would be useful with maybe the inconvenient to encourage quarkus context recreation as discussed in: