@Test public void concatenateTest() { String key = "-c"; String value = "test"; DSpaceCommandLineParameter dSpaceCommandLineParameter = new DSpaceCommandLineParameter(key, value); DSpaceCommandLineParameter dSpaceCommandLineParameter1 = new DSpaceCommandLineParameter(key, value); String key2 = "-r"; String value2 = "testing"; DSpaceCommandLineParameter dSpaceCommandLineParameter2 = new DSpaceCommandLineParameter(key2, value2); String key3 = "-t"; String value3 = null; DSpaceCommandLineParameter dSpaceCommandLineParameter3 = new DSpaceCommandLineParameter(key3, value3); List<DSpaceCommandLineParameter> dSpaceCommandLineParameterList = new ArrayList<>(); dSpaceCommandLineParameterList.add(dSpaceCommandLineParameter); dSpaceCommandLineParameterList.add(dSpaceCommandLineParameter1); dSpaceCommandLineParameterList.add(dSpaceCommandLineParameter2); dSpaceCommandLineParameterList.add(dSpaceCommandLineParameter3); String concatenedString = DSpaceCommandLineParameter.concatenate(dSpaceCommandLineParameterList); assertThat("concatenateTest", concatenedString, equalTo( dSpaceCommandLineParameter.toString() + DSpaceCommandLineParameter.SEPARATOR + dSpaceCommandLineParameter1 .toString() + DSpaceCommandLineParameter.SEPARATOR + dSpaceCommandLineParameter2 .toString() + DSpaceCommandLineParameter.SEPARATOR + dSpaceCommandLineParameter3.toString())); }
public static String concatenate(List<DSpaceCommandLineParameter> parameterList) { if (parameterList.isEmpty()) { return null; } return parameterList.stream().map(parameter -> parameter.toString()).collect(Collectors.joining(SEPARATOR)); }
DSpaceCommandLineParameter { public static String concatenate(List<DSpaceCommandLineParameter> parameterList) { if (parameterList.isEmpty()) { return null; } return parameterList.stream().map(parameter -> parameter.toString()).collect(Collectors.joining(SEPARATOR)); } }
DSpaceCommandLineParameter { public static String concatenate(List<DSpaceCommandLineParameter> parameterList) { if (parameterList.isEmpty()) { return null; } return parameterList.stream().map(parameter -> parameter.toString()).collect(Collectors.joining(SEPARATOR)); } DSpaceCommandLineParameter(String key, String value); protected  DSpaceCommandLineParameter(String parameter); }
DSpaceCommandLineParameter { public static String concatenate(List<DSpaceCommandLineParameter> parameterList) { if (parameterList.isEmpty()) { return null; } return parameterList.stream().map(parameter -> parameter.toString()).collect(Collectors.joining(SEPARATOR)); } DSpaceCommandLineParameter(String key, String value); protected  DSpaceCommandLineParameter(String parameter); String getName(); void setName(String key); String getValue(); void setValue(String value); String toString(); static String concatenate(List<DSpaceCommandLineParameter> parameterList); @Override boolean equals(Object other); @Override int hashCode(); }
DSpaceCommandLineParameter { public static String concatenate(List<DSpaceCommandLineParameter> parameterList) { if (parameterList.isEmpty()) { return null; } return parameterList.stream().map(parameter -> parameter.toString()).collect(Collectors.joining(SEPARATOR)); } DSpaceCommandLineParameter(String key, String value); protected  DSpaceCommandLineParameter(String parameter); String getName(); void setName(String key); String getValue(); void setValue(String value); String toString(); static String concatenate(List<DSpaceCommandLineParameter> parameterList); @Override boolean equals(Object other); @Override int hashCode(); static String SEPARATOR; }