@Test public void alpha_gamma_newline_newline_omega_results_in_three_entries() { List<String> commands = CLITextUtil.convertToList("alpha gamma\n\nomega"); assertContains(commands, "alpha","gamma","omega"); }
public static List<String> convertToList(String string) { List<String> list = new ArrayList<String>(); if (string==null){ return list; } String transformed = P.matcher(string).replaceAll(" "); String[] lines = transformed.split(" "); for (String line: lines){ if (!line.isEmpty()){ list.add(line); } } return list; }
CLITextUtil { public static List<String> convertToList(String string) { List<String> list = new ArrayList<String>(); if (string==null){ return list; } String transformed = P.matcher(string).replaceAll(" "); String[] lines = transformed.split(" "); for (String line: lines){ if (!line.isEmpty()){ list.add(line); } } return list; } }
CLITextUtil { public static List<String> convertToList(String string) { List<String> list = new ArrayList<String>(); if (string==null){ return list; } String transformed = P.matcher(string).replaceAll(" "); String[] lines = transformed.split(" "); for (String line: lines){ if (!line.isEmpty()){ list.add(line); } } return list; }  }
CLITextUtil { public static List<String> convertToList(String string) { List<String> list = new ArrayList<String>(); if (string==null){ return list; } String transformed = P.matcher(string).replaceAll(" "); String[] lines = transformed.split(" "); for (String line: lines){ if (!line.isEmpty()){ list.add(line); } } return list; }  static List<String> convertToList(String string); }
CLITextUtil { public static List<String> convertToList(String string) { List<String> list = new ArrayList<String>(); if (string==null){ return list; } String transformed = P.matcher(string).replaceAll(" "); String[] lines = transformed.split(" "); for (String line: lines){ if (!line.isEmpty()){ list.add(line); } } return list; }  static List<String> convertToList(String string);  }