Right now I have this
ByteArrayInputStream in = new ByteArrayInputStream("2".getBytes());
System.setIn(in);
//code that does something with user inputs
But the issue is that in //code that does something I have multiple user input prompts, is it possible to form a list of the user input and have it pick up the corresponding input when the time comes? I tried doing silly things like "2\n2\n10\nHello\n".getBytes() but that didn't work.
EDIT:
I am getting my user input with a Scanner object:
Scanner inputScanner = new Scanner(System.in);
inputScanner.nextLine();