title: Problems with Kotlin Result<T> on unit tests
body: <p>I am working on an android Application and I opted to use Kotlin Result class so as to handle success/failure on my operations. I made the changes to the code, but the tests stop working and I cannot understand why. Here I show you some snippets:</p>
  <p><strong>FireStoreClient.kt</strong></p>
  <pre><code>suspend fun items(): Result&lt;ItemsResponse&gt;
  </code></pre>
  <p><strong>NetworkDataSource.kt</strong></p>
  <pre><code>suspend fun getItems(): List&lt;Item&gt; =
      fireStoreClient.items().fold({ it.items.map { item -&gt; item.toDomain() } }, { emptyList() })
  </code></pre>
  <p><strong>NetworkDataSourceTest.kt</strong></p>
  <pre><code>@ExperimentalCoroutinesApi
  @Test
  fun `Check getItems works properly`() = runBlockingTest {
      whenever(fireStoreClient.items()).doReturn(success(MOCK_ITEMS_DOCUMENT))
      val expectedResult = listOf(
          Item(
              id = 1,
              desc = &quot;Description 1&quot;
          ),
          Item(
              id = 2,
              desc = &quot;Description 2&quot;
          )
      )
      assertEquals(expectedResult, dataSource.getItems())
  }
  </code></pre>
  <p>And this is the exception I am getting right now. Any clue? It appears that the fold() method is not being executed when unit testing.</p>
  <pre><code>java.lang.ClassCastException: kotlin.Result cannot be cast to ItemsResponse
  
      at NetworkDataSource.getItems(NetworkDataSource.kt:31)
  </code></pre>