Skip to content

TextUtils.isEmpty creates problems when unit testing with Mockito #3343

@kbhardwaj123

Description

@kbhardwaj123

Summary:

While i was creating unit tests for some files which i changed. It used TextUtils.isEmpty which when tested using mockito always return false because of unitTests.returnDefaultValues = false mentioned in the gradle files

right now there are two work arounds:

  • use PowerMockito and write mock logic for TextUtils.isEmpty
  • use Robolectric which 10x time to run a test

Would you like to Contribute:
Yes

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