mercredi 27 novembre 2019

How to unit test private variables using Reflection and in Kotlin language?

This is a Kotlin code snippet. I want to unit test if values are getting set in the following private variables. I am writing unit tests in Kotlin language. How can this be done using Reflection?

object Counter {
  private var: num1: Int = 0
  private var: num2: Int = 0

  fun setValues(val1: Int, val2: Int) {
    num1 = val1
    num2 = val2
  }
}




Aucun commentaire:

Enregistrer un commentaire