Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

2.2K
Views
Kotlin MockK: io.mockk.MockKException: no answer found for

This is my code snippet:

@Test
fun `request should return anon id if query param present`(@MockK(relaxed = true) req: ServerRequest)

I'm using JUnit5(Jupiter). The exception I've got is:

io.mockk.MockKException: no answer found for: ServerRequest(#1).cookies()

This is weird because if I understood relaxed correctly, my instance of ServerRequest should always have some value.

Why doesn't it in my case?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I figured out while I was writing the question that there is another alternative to specify relaxed, via @RelaxedMockK. And imagine my surprise, it works:

@Test
fun `request should return anon id if query param present`(@RelaxedMockK req: ServerRequest) {
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!