ArgumentsFile { public String generateContent() { if (argNames.isEmpty() || argValues.isEmpty()) { return ""; } final Optional<String> longestArg = argNames.stream() .filter(line -> !line.startsWith("#")) .max(Comparator.comparingInt(String::length)); final BiFunction<String, String, String> joiningFunction = (arg, val) -> arg.startsWith("#") ? arg : (Strings.padEnd(arg, longestArg.get().length() + 1, ' ') + val); return zip(argNames.stream(), argValues.stream(), joiningFunction) .map(String::trim) .collect(joining("\n")); } ArgumentsFile(); String generateContent();  }
@Test public void emptyContentIsGenerated_whenNoLineWasAdded() { final ArgumentsFile file = new ArgumentsFile(); assertThat(file.generateContent()).isEmpty(); }