详见:https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000556544-Why-can-t-I-input-anything-from-console-when-i-run-unit-test-with-JUNIT
参考网上资料发现,只需在如下两个文件中末尾加入-Deditable.java.test.console=true,然后重启idea即可: