How do you mock certain calls using the HttpClient...
# micronaut
g
How do you mock certain calls using the HttpClient in Micronaut tests? I've got a simple service at the moment which hooks up to MongoDB to retrieve a list of things. I've got a controller talking to a service (via an Interface) which in turn talks to repository (via an Interface). In the test, I'm simply checking that when I invoke
httpClient.toBlocking().retrieve("/endpoint")
it returns me a mocked list of items. I want to mock the call to the repository to isolate the test to the service and not involved MongoDB - trying to do this with the mockk framework:
every { repository.getStuff() } returns listOf(stuff)
However, this mock is being ignored and my test is actually invoking the repository code. Is there a way to mock a repository in Micronaut? Or is this more a question of, this style of test should probably use an in memory DB and do an end-to-end test? TIA