I assume you have a thing like:
public static void main(String[] args) {
...
}
This can used as an entry point to your application and before that you change the input channel via:
FileInputStream is = new FileInputStream(new File("test.data"));
System.setIn(is);
The above can be used within a unit/integration test.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…