@Test public void parseReturnsCorrectArgWithMoreNullsAtEnd() { String cmdLine = "toasters.sh\0ayy lmaoo\0\0\0\0\0\0\0\0"; String result = parser.parse(cmdLine).get(); assertEquals("toasters.sh ayy lmaoo", result); }
public Optional<String> parse(String cmdlineFileContents) { return Optional.ofNullable(cmdlineFileContents) .map(s -> StringUtils.strip(s, ARG_SEPARATOR + "")) .map(s -> s.replace(ARG_SEPARATOR, ARG_SEPARATOR_REPLACEMENT)); }
CmdlineFileParser { public Optional<String> parse(String cmdlineFileContents) { return Optional.ofNullable(cmdlineFileContents) .map(s -> StringUtils.strip(s, ARG_SEPARATOR + "")) .map(s -> s.replace(ARG_SEPARATOR, ARG_SEPARATOR_REPLACEMENT)); } }
CmdlineFileParser { public Optional<String> parse(String cmdlineFileContents) { return Optional.ofNullable(cmdlineFileContents) .map(s -> StringUtils.strip(s, ARG_SEPARATOR + "")) .map(s -> s.replace(ARG_SEPARATOR, ARG_SEPARATOR_REPLACEMENT)); }  }
CmdlineFileParser { public Optional<String> parse(String cmdlineFileContents) { return Optional.ofNullable(cmdlineFileContents) .map(s -> StringUtils.strip(s, ARG_SEPARATOR + "")) .map(s -> s.replace(ARG_SEPARATOR, ARG_SEPARATOR_REPLACEMENT)); }  Optional<String> parse(String cmdlineFileContents); }
CmdlineFileParser { public Optional<String> parse(String cmdlineFileContents) { return Optional.ofNullable(cmdlineFileContents) .map(s -> StringUtils.strip(s, ARG_SEPARATOR + "")) .map(s -> s.replace(ARG_SEPARATOR, ARG_SEPARATOR_REPLACEMENT)); }  Optional<String> parse(String cmdlineFileContents);  }