Testing Task with UserInputHandler

I have a task written that internally uses a UserInputHandler to ask the user for some values. I would like to have a test exercising this task using the GradleRunner test fixture but I have been unable to figure out how to provide the UserInputHandler answers to the questions that it is asking.

I had a poke around the Gradle repo itself and looked at the InitBuild task and it’s test cases but nothing stood out to me.

Does anyone know if this is possible?

Would it be possible to add properties to your task and only ask the user if those properties aren’t set?

That would definitely work. I can set the convention of each property to be a provider which will call the user input handler with the necessary question and in my test case I can just set the values statically in the build file!

Thanks for the suggestion!