@Test public void testListCows() { System.out.println("cowsay -list"); String[] args = new String[]{"-list"}; String[] expected = TestUtils.getCowjarCowNames(new String[]{"cowjar"}); String[] actual = Cowsay.say(args).split(" "); Assert.assertArrayEquals(expected, actual); }
private static String listCows(final CommandLine commandLine) { String[] files = Cowloader.listAllCowfiles(); if (files != null) { if (commandLine.hasOption(CowsayCli.Opt.LIST_COWS.toString())) { return StringUtils.join(files, " "); } return StringUtils.join(files, System.lineSeparator()); } return ""; }
Cowsay { private static String listCows(final CommandLine commandLine) { String[] files = Cowloader.listAllCowfiles(); if (files != null) { if (commandLine.hasOption(CowsayCli.Opt.LIST_COWS.toString())) { return StringUtils.join(files, " "); } return StringUtils.join(files, System.lineSeparator()); } return ""; } }
Cowsay { private static String listCows(final CommandLine commandLine) { String[] files = Cowloader.listAllCowfiles(); if (files != null) { if (commandLine.hasOption(CowsayCli.Opt.LIST_COWS.toString())) { return StringUtils.join(files, " "); } return StringUtils.join(files, System.lineSeparator()); } return ""; } private  Cowsay(); }
Cowsay { private static String listCows(final CommandLine commandLine) { String[] files = Cowloader.listAllCowfiles(); if (files != null) { if (commandLine.hasOption(CowsayCli.Opt.LIST_COWS.toString())) { return StringUtils.join(files, " "); } return StringUtils.join(files, System.lineSeparator()); } return ""; } private  Cowsay(); static String say(final String[] args); static String think(final String[] args); static void main(final String[] args); }
Cowsay { private static String listCows(final CommandLine commandLine) { String[] files = Cowloader.listAllCowfiles(); if (files != null) { if (commandLine.hasOption(CowsayCli.Opt.LIST_COWS.toString())) { return StringUtils.join(files, " "); } return StringUtils.join(files, System.lineSeparator()); } return ""; } private  Cowsay(); static String say(final String[] args); static String think(final String[] args); static void main(final String[] args);  }