You can write this sort of a test quite well with
Java but a shell scripting language such as Bash could be an even better match (unless you want to be able to run those tests within your
IDE, for example, in which case a
JUnit test would probably be your best option).
The installation script is apparently expecting the user input from
stdin a.k.a.
System.in, which means that you could do something like this: