package io.mockk.impl.recording.states

import io.mockk.MockKException
import io.mockk.impl.recording.CommonCallRecorder

class StubbingState(recorder: CommonCallRecorder) : RecordingState(recorder) {
    override fun recordingDone(): CallRecordingState {
        checkMissingCalls()
        return recorder.factories.stubbingAwaitingAnswerState(recorder)
    }

    private fun checkMissingCalls() {
        if (recorder.calls.isEmpty()) {
            throw MockKException("Cannot use every { ... } block with not mocked class")
        }
    }
}

package io.mockk.impl.recording.states

import io.mockk.MockKException
import io.mockk.impl.recording.CommonCallRecorder

class StubbingState(recorder: CommonCallRecorder) : RecordingState(recorder) {
    override fun recordingDone(): CallRecordingState {
        checkMissingCalls()
        return recorder.factories.stubbingAwaitingAnswerState(recorder)
    }

    private fun checkMissingCalls() {
        if (recorder.calls.isEmpty()) {
            throw MockKException("Cannot use every { ... } block with a non mocked class")
        }
    }
}

Apply suggestions on exception message
Apply suggestions on exception message

mockk/mockk,mockk/mockk,mockk/mockk,mockk/mockk,mockk/mockk,mockk/mockk