tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xavier Dury <kal...@hotmail.com>
Subject ApplicationComposer and qualified mocks
Date Wed, 05 Apr 2017 10:22:29 GMT
Hi,


When using ApplicationComposer, I can declare mocks in my test classes like that:


@Mock

MyDependency myDependency;


@MockInjector
public Class<?> mockInjector() { return MockitoInjector.class; }

But that does not seem to work with (un@Named) qualified mocks:


@Mock

@MyQualifier

MyDependency myDependency;

Of course, I can still make a producer for the qualified mock like this:

@Produces
@MyQualifier
MyDependency myDependency() { return Mockito.mock(MyDependency.class); }

But I wanted to know if that was the only way to do it because, now, I have to programmatically
create the mock instead of declaring it with @Mock.

Thanks,

Xavier


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message