title: How to mock ObjectMapper.readValue() using mockk
body: <p>There was a similar question asked about Mockito <a href="https://stackoverflow.com/questions/48575356/how-to-mock-objectmapper-readvalue-using-mockito">here</a></p>
  
  <p>I have a situation where I would like to mock out <code>readValue</code> in the following line</p>
  
  <pre><code> val animal: Animal = objectMapper.readValue(String(message.body))
  </code></pre>
  
  <p>I tried</p>
  
  <pre><code>@Test
  fun `test you filthy animal`() {
      val animal = Animal("bird")
  
      every {
          objectMapper.readValue(any&lt;String&gt;())
      } returns animal
  }
  </code></pre>
  
  <p>...but I keep getting the following error:</p>
  
  <p><code>Not enough information to infer type variable T</code></p>
  
  <p>I have been scratching my head trying to figure it out in <a href="https://mockk.io/" rel="nofollow noreferrer">Mockk</a>.</p>