[mockito.kotlin → mockk] Migrated intellij.platform.collaborationTools tests from mockito.kotlin to mockk

GitOrigin-RevId: a32f088ab16bb02c5f2ac2d0944edf341cba97f8
This commit is contained in:
Ilia Bogdanovich
2024-08-14 11:56:49 +02:00
committed by intellij-monorepo-bot
parent ff9954f400
commit c76be9c0b8
3 changed files with 9 additions and 9 deletions

View File

@@ -24,8 +24,6 @@
<orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
<orderEntry type="module" module-name="intellij.platform.credentialStore.ui" />
<orderEntry type="module" module-name="intellij.platform.testFramework" scope="TEST" />
<orderEntry type="library" scope="TEST" name="mockito" level="project" />
<orderEntry type="library" scope="TEST" name="mockito.kotlin" level="project" />
<orderEntry type="module" module-name="intellij.platform.vcs.impl" />
<orderEntry type="module" module-name="intellij.platform.ide.util.io" />
<orderEntry type="module" module-name="intellij.platform.vcs.log" />
@@ -38,5 +36,7 @@
<orderEntry type="library" scope="TEST" name="kotlinx-coroutines-test" level="project" />
<orderEntry type="module" module-name="intellij.platform.vcs.dvcs.impl" />
<orderEntry type="module" module-name="intellij.platform.util.coroutines" />
<orderEntry type="library" scope="TEST" name="io.mockk" level="project" />
<orderEntry type="library" scope="TEST" name="io.mockk.jvm" level="project" />
</component>
</module>

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.collaboration.auth
import io.mockk.mockk
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.test.runTest
@@ -8,7 +9,6 @@ import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import org.mockito.kotlin.mock
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
@@ -39,7 +39,7 @@ class AccountManagerBaseTest {
@Before
fun setUp() {
manager = object : AccountManagerBase<MockAccount, String>(mock()) {
manager = object : AccountManagerBase<MockAccount, String>(mockk(relaxUnitFun = true)) {
override fun accountsRepository() = accountsRepository
override fun credentialsRepository() = credentialsRepository
}

View File

@@ -1,14 +1,14 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.collaboration.auth
import io.mockk.every
import io.mockk.mockk
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.runTest
import org.junit.Assert.*
import org.junit.Test
import org.mockito.kotlin.any
import org.mockito.kotlin.mock
@OptIn(ExperimentalCoroutinesApi::class)
class AccountUrlAuthenticationFailuresHolderTest {
@@ -16,14 +16,14 @@ class AccountUrlAuthenticationFailuresHolderTest {
@Test
fun `test not failed on token change`() = runTest(UnconfinedTestDispatcher()) {
val credsFlow = MutableSharedFlow<String>()
val accountManager = mock<AccountManager<Account, String>> {
on(it.getCredentialsFlow(any())).thenReturn(credsFlow)
val accountManager = mockk<AccountManager<Account, String>> {
every { getCredentialsFlow(any()) } returns credsFlow
}
val holder = AccountUrlAuthenticationFailuresHolder(this) {
accountManager
}
val account = mock<Account>()
val account = mockk<Account>()
holder.markFailed(account, "123")
assertTrue(holder.isFailed(account, "123"))