Mocking @ConfigurationProperties in Spock with Kotlin not work
Solution 1:
JwtProperties in your application is instantiated by spring. Spring will read value in the properties file and then create the instance with the required value.
In your test you don't have any spring context so nothing will create of JwtProperties for you. Furthermore you are mocking it. I think there is no point on mocking this because you just have to create the instance with the value you want.
Just do:
class JwtTokenProviderTest extends Specification {
private JwtProperties jwtProperties = JwtProperties("my-secret", 60, 120)
private AuthDetailsService authDetailsService = GroovyMock(AuthDetailsService)
private JwtTokenProvider jwtTokenProvider = new JwtTokenProvider(authDetailsService, jwtProperties)