Skip to content

Commit

Permalink
Fixed tests (hopefully?)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Poulton committed May 3, 2022
1 parent ea44d35 commit 5a21f31
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions mockk/jvm/src/test/kotlin/io/mockk/junit4/MockKRuleTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ import io.mockk.every
import io.mockk.impl.annotations.MockK
import io.mockk.impl.annotations.RelaxedMockK
import io.mockk.impl.annotations.SpyK
import io.mockk.junit5.MockKExtension
import io.mockk.verify
import org.junit.Rule
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import kotlin.test.assertEquals
import kotlin.test.assertNull
import kotlin.test.assertTrue
Expand Down Expand Up @@ -45,7 +43,7 @@ class MockKRuleTest {
}

@MockK
private lateinit var car2: Car
private lateinit var car: Car

@RelaxedMockK
private lateinit var relaxedCar: Car
Expand All @@ -54,7 +52,7 @@ class MockKRuleTest {
private var carSpy = Car()

@Test
fun injectsValidMockInMethods(@MockK car: Car) {
fun injectsValidMockInClass() {
every {
car.recordTelemetry(
speed = more(50),
Expand All @@ -69,29 +67,6 @@ class MockKRuleTest {
assertEquals(Outcome.RECORDED, result)
}

@Test
fun injectsValidMockInClass() {
every {
car2.recordTelemetry(
speed = more(50),
direction = Direction.NORTH,
lat = any(),
long = any()
)
} returns Outcome.RECORDED

val result = car2.recordTelemetry(51, Direction.NORTH, 1.0, 2.0)

assertEquals(Outcome.RECORDED, result)
}

@Test
fun injectsValidRelaxedMockInMethods(@RelaxedMockK car: Car) {
val result = car.relaxedTest()

assertTrue(result is RelaxedOutcome)
}

@Test
fun injectsValidRelaxedMockInClass() {
val result = relaxedCar.relaxedTest()
Expand Down

0 comments on commit 5a21f31

Please sign in to comment.