Skip to content

Trouble with DoNotMock and non-default mock frameworks #361

@andrewparmet

Description

@andrewparmet

I'm using version 0.8.2 and trying to use the options to support other mocking frameworks in my Android project. I'm finding that my annotation and factories values aren't being respected. Here's a minimal reproducer: https://github.com/andrewparmet/do-not-mock-lint-example

Here's what my lint.xml looks like:

<lint>
    <issue id="DoNotMock">
        <option name="mock-annotations" value="org.mockito.Mock,org.mockito.Spy,io.mockk.impl.annotations.MockK,io.mockk.impl.annotations.SpyK"/>
        <option name="mock-factories" value="org.mockito.Mockito#mock,org.mockito.Mockito#spy,io.mockk.MockKKt#mockk,io.mockk.MockKKt#mockkClass,io.mockk.MockKKt#mockkObject,io.mockk.MockKKt#spyk,com.nhaarman.mockitokotlin2.MockingKt#mock,com.nhaarman.mockitokotlin2.SpyingKt#spy,org.mockito.kotlin.MockingKt#mock,org.mockito.kotlin.SpyingKt#spy"/>
    </issue>
</lint>

Lint detects usages of the default Mockito symbols but none of the others. In fact no change I make appears to be respected - Mockito symbols are still detected even if I set the properties to be empty strings.

I do know that this XML file is being picked up by lint - if I set the severity to ignore then no issues are reported at all.

Any suggestions for where I might be doing something wrong? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions