mercredi 25 novembre 2015

Android Unit test - mock inner class method

Class A has a method which create new instance of class B and call to Android API functionality.

Class A{

    public void foo(){
        B b = new B();

        //some code

        b.callAndroidAPI()

        //some code

    }
}

How can i do unit test for class b foo() method. Is there any way to override/mock the callAndroidAPI() before calling to foo()? Thanks!

Aucun commentaire:

Enregistrer un commentaire