title: How to unit test a class that uses context?
body: <p>I'm trying to test a simple method.</p>
  
  <p>I have this class:</p>
  
  <pre><code>class Cloud @Inject constructor(var posx: Double = 0.0, var posy: Double = 0.0, var velocity: 
      Double = 1.0, val context: Context){
  
      val image: Bitmap = BitmapFactory.decodeResource(context.resources, R.raw.cloud)
  
      fun updateVelocity(){
          velocity += 5.0
      }
  
      fun draw(canvas: Canvas){
          canvas.drawBitmap(image,posx.toFloat() - (image.width / 2),posy.toFloat(),null)
      }    
  }
  </code></pre>
  
  <p>I want to unit test the <code>updateVelocity()</code> method but i can't figure out how, should i use an instrumental test and pass the context or can i use something like mockk?</p>
  
  <p>Can i do this with mockk?</p>
  
  <pre><code>@Test
  fun cloudVelocity() { 
      val cloud: Cloud = mockk()                
      //update cloud velocity
      //assert that the velocity changed 
  }
  </code></pre>