Skip to content

Commit

Permalink
🚚 : move inline function whenever in specific utils file
Browse files Browse the repository at this point in the history
  • Loading branch information
cdubuisson committed Feb 2, 2020
1 parent 070d66e commit ebc1677
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.codeka.gaia.modules.api

import io.codeka.gaia.registries.controller.whenever
import io.codeka.gaia.test.whenever
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.mockito.InjectMocks
import org.mockito.Mock
import org.mockito.Mockito
import org.mockito.Mockito.verify
import org.mockito.Mockito.verifyNoMoreInteractions
import org.mockito.junit.jupiter.MockitoExtension
import org.mockito.stubbing.OngoingStubbing

@ExtendWith(MockitoExtension::class)
class GithubRegistryControllerTest{
class GithubRegistryControllerTest {

@Mock
lateinit var githubRegistryApi: RegistryApi<GithubRepository>
Expand Down Expand Up @@ -51,7 +49,3 @@ class GithubRegistryControllerTest{
verifyNoMoreInteractions(registryService)
}
}

inline fun <T> whenever(methodCall: T): OngoingStubbing<T> {
return Mockito.`when`(methodCall)!!
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import io.codeka.gaia.modules.bo.Variable
import io.codeka.gaia.modules.repository.TerraformModuleRepository
import io.codeka.gaia.registries.RegistryApi
import io.codeka.gaia.registries.RegistryType
import io.codeka.gaia.registries.controller.whenever
import io.codeka.gaia.registries.github.GithubRepository
import io.codeka.gaia.registries.gitlab.GitlabRepository
import io.codeka.gaia.teams.User
import io.codeka.gaia.test.whenever
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
Expand Down
8 changes: 8 additions & 0 deletions src/test/java/io/codeka/gaia/test/KotlinUtils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.codeka.gaia.test

import org.mockito.Mockito
import org.mockito.stubbing.OngoingStubbing

inline fun <T> whenever(methodCall: T): OngoingStubbing<T> {
return Mockito.`when`(methodCall)!!
}

0 comments on commit ebc1677

Please sign in to comment.