lundi 1 août 2016

android.util.Patterns Unit test returns NullPointerException

I'm starting to work with unit tests in android I have trying to test a method that uses:

android.util.Patterns.EMAIL_ADDRESS.matcher(validEmail).matches()

it should return true as I added this in my build.gradle

testOptions { 
    unitTests {
        returnDefaultValues = true
    }
} 

Still the test throws a NullPointerException.

I have two questions: 1- How do I fix this? 2- Should I reconsider my design and remove the android dependency to a mock object.

Aucun commentaire:

Enregistrer un commentaire