@WithMockUser and kotlin test

373 Views Asked by At

I'm a big fan of Kotlintest syntax and I'd like to know if it's possible to make it work with WebMvcTest. More particularly, I don't manage to annotate the test methods with @WithMockUser.

Does somebody know if it's feasible?

Thanks beforehand.

1

There are 1 best solutions below

0
On

It's not something that is currently built into KotlinTest but there is a Spring module, so it should be fairly easy to create another extension that provides this.

This is the source for the spring module. https://github.com/kotlintest/kotlintest/tree/master/kotlintest-samples/kotlintest-samples-spring