You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In couple of our projects we were trying to use mockk in a following way:
@Retention(RUNTIME)
@Target(TYPE)
@CheckUnnecessaryStub
@ExtendWith(MockKExtension.class)
public @interface MockkTest {
}
Our goal is to be able to quickly annotate all of our tests by simply @MockkTest, which would configure some default behaviour like checking for unnecessary stubs and eventually more. This way we could end up with multiple annotations like @MockWithStubsCheck, @MockWithVerificationEnabled` etc
Unfortunately, after some testing, I have found out that MockkExtension is checking for the presence of an annotation on a class or eventually looking for a configured property. Snippet below:
Hey,
In couple of our projects we were trying to use mockk in a following way:
Our goal is to be able to quickly annotate all of our tests by simply
@MockkTest
, which would configure some default behaviour like checking for unnecessary stubs and eventually more. This way we could end up with multiple annotations like@MockWithStubsCheck
, @MockWithVerificationEnabled` etcUnfortunately, after some testing, I have found out that
MockkExtension
is checking for the presence of an annotation on a class or eventually looking for a configured property. Snippet below:So, in a nutshell, it does not have any support for meta annotations. Is there any big deal for you to add that?
Currently, we are trying to mitigate it by adding the following snippet to
build.gradle
:but its not scalable and we would like to eventually have that annotation as a part of some internal lib so we could reuse it in various places.
Thanks for the feedback
The text was updated successfully, but these errors were encountered: