@Test public void parseReturnsEmptyStringIfSourceStringIsJustNulls() { String args = "\0\0\0\0\0\0\0"; String result = parser.parse(args).get(); assertEquals("", 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);  }