Ellen Spertus
03/25/2020, 12:15 AMprivate fun makeResolveInfo(appName: String, packageName: String, exported: Boolean = true) :
ResolveInfo {
val activityInfo = mockk<ActivityInfo>()
every { activityInfo.exported } returns exported
// remaining code omitted
The program crashes on the line with every
:
io.mockk.MockKException: Missing calls inside every { ... } block.
at io.mockk.impl.recording.states.StubbingState.checkMissingCalls(StubbingState.kt:14)
at io.mockk.impl.recording.states.StubbingState.recordingDone(StubbingState.kt:8)
at io.mockk.impl.recording.CommonCallRecorder.done(CommonCallRecorder.kt:47)
at io.mockk.impl.eval.RecordedBlockEvaluator.record(RecordedBlockEvaluator.kt:60)
at io.mockk.impl.eval.EveryBlockEvaluator.every(EveryBlockEvaluator.kt:30)
at io.mockk.MockKDsl.internalEvery(API.kt:92)
at io.mockk.MockKKt.every(MockK.kt:104)
at mozilla.voice.assistant.intents.MetadataTest$Companion.makeResolveInfo(MetadataTest.kt:61)
Any idea what I’m doing wrong? The file is in a test
directory rather than androidTest
. I don’t know if that could be a problem.streetsofboston
03/25/2020, 2:44 AMEllen Spertus
03/25/2020, 2:45 AMval activityInfo = mockk<ActivityInfo>(relaxed = true)
every { activityInfo.exported } returns exported
Matt Thompson
03/26/2020, 10:54 PMtest
directory - maybe specify @RunWith(AndroidJUnit4::class)
on the class to get the robolectric test runner