in

test with firebase database throwing error


I’m using firebase in my project and i’m testing all the functionalities which includes firebase components and i recently tried to test firebase database but it is throwing an error which i could not understand if someone could help , i would appreciate it , Thank you

  • This is my testing code
  @Test
    fun testCaseSendMessage(){
        val databaseMock = mock(DatabaseReference::class.java)
        ServiceLocator.reference = databaseMock
        `when`(databaseMock.child("Messages").child("1251515").setValue(Utils.message()))
            .thenReturn(isNotNull())

    }
  • This is my real code
    val messageMap = hashMapOf<String,Any>()
        messageMap["userName"] = userName
        messageMap["userMessage"] = message
        messageMap["userPic"] = userPic
        messageMap["messageTiming"] = Calendar.getInstance().timeInMillis.toString()
        messageMap["chatImage"] = downloadUrl
        messageMap["uid"] = firebaseAuth.currentUser!!.uid

        ServiceLocator.reference
            .child("Messages")
            .child(System.currentTimeMillis().toString())
            .setValue(messageMap).await()



Source: https://stackoverflow.com/questions/70718019/test-with-firebase-database-throwing-error

A small python program that reminds to take a water break every 15 minutes and a screen break every 30 minutes

Unable to send a message to Discord using discord.py