### Question:
UIConfigurationLoader extends ConfigurationLoader { public boolean loadConfiguration() throws IOException { for (Map.Entry<String, Object> entry : defaultConfig.entrySet()) { System.out.printf("'%s' will be initiated as: (%s)%n", entry.getKey(), entry.getValue()); } System.out.println("Is it OK(y/n)?"); Scanner scanner = new Scanner(System.in); String answer = scanner.nextLine(); int cnt = 1; while (!answer.equals("yes") && !answer.equals("y") && !answer.equals("no") && !answer.equals("n")) { System.out.println(answer); System.out.println("Please enter yes/y or no/n."); System.out.println("Is it OK(Y/N)?"); answer = scanner.nextLine(); cnt++; if (cnt == 3) { break; } } if (answer.equals("yes") || answer.equals("y")) { System.out.println("We will use the default values to initialize."); return true; } else if (answer.equals("no") || answer.equals("n")) { System.out.println("Please set your own configurations in 'config.yml' and run again."); File file = new File("config.yml"); writeDefaultConfiguration(file); return false; } else { System.out.println("Abort!"); return false; } } UIConfigurationLoader(List<Variable> variables); boolean loadConfiguration(); Map<String, Object> getDefaultConfig(); Set<String> getVariableNames();  }### Answer:
@Test public void loadY() throws Exception { String input = "yes"; InputStream in = new ByteArrayInputStream(input.getBytes()); System.setIn(in); configLoader.loadConfiguration(); }
@Test public void loadN() throws Exception { String input = "no"; InputStream in = new ByteArrayInputStream(input.getBytes()); System.setIn(in); configLoader.loadConfiguration(); tearDown(); }
@Test public void loadOther() throws Exception { String input = "other\nother\nother"; InputStream in = new ByteArrayInputStream(input.getBytes()); System.setIn(in); configLoader.loadConfiguration(); }
@Test public void loadOtherY() throws Exception { String input = "other\nother\nyes"; InputStream in = new ByteArrayInputStream(input.getBytes()); System.setIn(in); configLoader.loadConfiguration(); }