title: Mockito cannot mock/spy because : Final Class
body: <p>I know this question is asked a lot of time, but I followed a lot of answer and it still didnt work</p>
  
  <p><a href="https://stackoverflow.com/questions/14292863/how-to-mock-a-final-class-with-mockito">How to mock a final class with mockito</a></p>
  
  <p>in this link, they said that we have to add in our gradle : </p>
  
  <pre><code>testImplementation 'org.mockito:mockito-inline:2.13.0'
  </code></pre>
  
  <p>=> Currently I have </p>
  
  <pre><code>testImplementation "org.mockito:mockito-inline:2.28.2"
  </code></pre>
  
  <p>I also have this single line in my MockMaker file : </p>
  
  <pre><code>mock-maker-inline
  </code></pre>
  
  <p>Then you can see my following code : </p>
  
  <pre><code>object ApiHelper {
  
  fun &lt;T&gt; createService(
          url: String,
          clazz: Class&lt;T&gt;
      ): T
  }
  </code></pre>
  
  <p>in my UITEST</p>
  
  <pre><code>    @Mock
      private lateinit var service: myService
  
      private lateinit var apiHelper: ApiHelper
  
      @Before
      fun setUp() {
  
          apiHelper = mock(ApiHelper::class.java)
  
          given(ApiHelper.createService(
              anyString(),
              MyService::class.java,
          )).willReturn(service)
      }
  </code></pre>
  
  <p>What is wrong with my code? Did I missed something? </p>