Need help to write a unit test using Mockito and JUnit4

前端 未结 10 1081
余生分开走
余生分开走 2020-12-15 04:06

Need help to write a unit test for the below code using Mockito and JUnit4,

public class MyFragmentPresenterImpl { 
      public Boolean isValid(String value         


        
10条回答
  •  孤城傲影
    2020-12-15 04:42

    You should use Robolectric:

    testImplementation "org.robolectric:robolectric:3.4.2"
    

    And then

    @RunWith(RobolectricTestRunner::class)
    class TestClass {
        ...
    }
    

提交回复
热议问题