Setting standardInput for test task

We have a use case wherein in each of the individual junit test cases, we ask the user for some input. Based on the input , we take some action. Example: if the expected output does not match with actual output. we will ask the user do you want to update expected output with the actual. If yes, we will update the expected to actual. And then proceed with the assertions.

From within eclipse IDE, we are able to achieve this.

However from the command line it’s not working and the build is failing with the error java.util.NoSuchElementException.

I think it’s basically because by default gradle sets an empty stdin for child processes and hence the error. We need a way where we can set the input stream to stdin something like below

standardInput =