title: getting error mocking firebase user with mockito
body: <p>I'm trying to mock a firebase user to provide it for my test , i have mocked the firebase auth class from which i get the uid of the currently signed in user but for some it keeps throwing the same error , i would appreciate your helps guys</p>
  <ul>
  <li>This is my production code</li>
  </ul>
  <pre><code>    private fun getUserProfileInfo(){
          val db = ServiceLocator.reference
          val child = db.child(&quot;Users&quot;)
          val user = ServiceLocator.firebaseUser
          val value = child.child(user!!.uid)
  
             value.addListenerForSingleValueEvent(object  : ValueEventListener {
                  override fun onDataChange(snapshot: DataSnapshot) {
                      if(snapshot.exists()){
                          val model = snapshot.getValue(ProfileModel::class.java)
                          userName = model!!.firstName
                          userPic = model.profilePicUrl
                      }
                  }
                  override fun onCancelled(error: DatabaseError) {
                  }
  
              })
      }
  </code></pre>
  <ul>
  <li>This is my testing code</li>
  </ul>
  <pre><code>  @Test
      fun testCaseProfileInfo(){
          val firebaseUserMock = mock(FirebaseUser::class.java)
          val firebaseMock = mock(FirebaseAuth::class.java)
          val databaseMock = mock(DatabaseReference::class.java)
  
          ServiceLocator.firebaseAuth = firebaseMock
          ServiceLocator.firebaseUser = firebaseUserMock
          ServiceLocator.reference = databaseMock
  
          doReturn(firebaseUserMock).`when`(firebaseMock).currentUser
          val uid = doReturn(&quot;123&quot;).`when`(firebaseMock).uid // error here
  
          doReturn(databaseMock.child(&quot;Users&quot;)
              .child(uid!!))
              .`when`(databaseMock).get()
      }
  </code></pre>
  <ul>
  <li>This is my Service Locator Class</li>
  </ul>
  <pre><code>object ServiceLocator {
      var firebaseAuth = FirebaseAuth.getInstance()
      var reference=FirebaseDatabase.getInstance(Utils.DATABASE_URL).reference
  }
  
  </code></pre>
  <ul>
  <li>Error generated ( after update )</li>
  </ul>
  <pre><code>org.mockito.exceptions.misusing.UnfinishedStubbingException: 
  Unfinished stubbing detected here:
  -&gt; at com.revert.journey.app.chatui.FriendsRequestActivityTest.testCaseProfileInfo
  
  </code></pre>
  <ul>
  <li>Quick Update</li>
  </ul>
  <pre><code>
   @Test
      fun testCaseProfileInfo(){
          val userMock = mock(FirebaseUser::class.java)
          val firebaseMock = mock(FirebaseAuth::class.java)
          val databaseMock = mock(DatabaseReference::class.java)
  
          ServiceLocator.firebaseAuth = firebaseMock
          ServiceLocator.firebaseUser = userMock
          ServiceLocator.reference = databaseMock
  
          doReturn(userMock).`when`(firebaseMock).currentUser
          doReturn(&quot;123&quot;).`when`(userMock)!!.uid
  
          doReturn(databaseMock
              .child(&quot;Users&quot;)
              .child(&quot;123&quot;)) //  ( null pointer exception on this string)..
              .`when`(databaseMock).get()
      }
  
  </code></pre>