Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

2.2K
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda