Arquillian is not meant to be used with Mockito.
You should work with an @Alternative which has to be added to an Arquillian @Deployment.
Even the official Jakarata CDI Spec reveals this way: It declares the @Mock Stereotype, which bundles @Alternative and @Priority:
@Alternative
@Priority(value = 0)
@Stereotype
@Target(TYPE)
@Retention(RUNTIME)
@interface Mock { }
@Mock
@Stateless
class MyFacesContext extends jakarta.faces.context.FacesContext {...}
@ExtendWith(ArquillianExtension.class)
class ArquillianTest {
@Deployment
static WebArchive createDeployment() {
return ShrinkWrap.create(WebArchive.class).addClasses(MyFacesContext.class);
}
@Inject
FacesContext facesContext;
@Test
void testMock() {
assertNotNull(facesContext)
}
}
There exist Libraries which try to associate Mockito with Arquillian like:
Their implementation missuses Mockito in some way.
Moreover it's not the way Jakarta EE thinks.