Home » Android » android – How to solve java.lang.AssertionError: in Mockk using livedata-Exceptionshub

android – How to solve java.lang.AssertionError: in Mockk using livedata-Exceptionshub

Posted by: admin February 26, 2020 Leave a comment

Questions:
it("sendEmail"){


    //viewModel.sendEmail()
   // viewModel.authInfo.observeForever(observerAuthInfo)


    run{
        viewModel.sendEmail()
    }

    Assert.assertEquals(expectAccount, viewModel.authInfo.value)


}

this is my code ,viewModel.authInfo.value as null i am getting how to fix this error
and here i am getting the error

expected:<Success(data=AuthInfo([email protected]))> but was:<null>
java.lang.AssertionError: expected:<Success(data=AuthInfo([email protected]))> but was:<null>
    at org.junit.Assert.fail(Assert.java:88)
    at org.junit.Assert.failNotEquals(Assert.java:834)
    at org.junit.Assert.assertEquals(Assert.java:118)
    at org.junit.Assert.assertEquals(Assert.java:144)
How to&Answers: