// imports...

@Configuration // for Spring's DI setup
class ApiTestDoubles(
    private val factory: ApiTestDoubleFactory
) {
    
    // 👇 one for each top-level service
    @Bean // this method's return value will be in the DI context for others to use
    fun users(): Users = factory
      .createTestDouble(Users::class.java) // specify service class
      .withMethod("create-user") { it.createUser(any()) } // define label for method
      .withMethod("get-users") { it.getUsers(any()) } // define label for another method
      .build() // build a test-double to use instead of 'Users' service
      
}