@Test public void createParametersForQueryPreferences() { checkLsofParameters( "lsof -F -T +c0 +D /path1 +d /path2 -d one -d two " + "-g 123 -g ^456 -g ^789 -u ^123 -u daniele -i 6TCP@localhost:123 -i 4:987 " + "-p ^123 -p 456 -p ^789 -c lsof -c ^glsof -l -s -a +L 5 -n -N -P -U -S 100 -b " + "-- /home/daniele /usr/lib/libXdmcp.so.6.0.0", _builder.build(createPreferences())); }
public String build(Preferences preferences) { final StringBuilder sb1 = new StringBuilder(COMMAND); final StringBuilder sb2 = new StringBuilder(); for (Filter tv : preferences.getFilters()) { final String type = tv.getType(); final boolean isPathType = type.equals(PATH.getId()); getParameterType(type).appendParameter(isPathType ? sb2 : sb1, tv); } preferences.getOtherPreferences().toParameters(sb1); if (sb2.length() > 0) sb1.append(" --").append(sb2); return sb1.toString(); }
LsofParametersBuilder { public String build(Preferences preferences) { final StringBuilder sb1 = new StringBuilder(COMMAND); final StringBuilder sb2 = new StringBuilder(); for (Filter tv : preferences.getFilters()) { final String type = tv.getType(); final boolean isPathType = type.equals(PATH.getId()); getParameterType(type).appendParameter(isPathType ? sb2 : sb1, tv); } preferences.getOtherPreferences().toParameters(sb1); if (sb2.length() > 0) sb1.append(" --").append(sb2); return sb1.toString(); } }
LsofParametersBuilder { public String build(Preferences preferences) { final StringBuilder sb1 = new StringBuilder(COMMAND); final StringBuilder sb2 = new StringBuilder(); for (Filter tv : preferences.getFilters()) { final String type = tv.getType(); final boolean isPathType = type.equals(PATH.getId()); getParameterType(type).appendParameter(isPathType ? sb2 : sb1, tv); } preferences.getOtherPreferences().toParameters(sb1); if (sb2.length() > 0) sb1.append(" --").append(sb2); return sb1.toString(); }  }
LsofParametersBuilder { public String build(Preferences preferences) { final StringBuilder sb1 = new StringBuilder(COMMAND); final StringBuilder sb2 = new StringBuilder(); for (Filter tv : preferences.getFilters()) { final String type = tv.getType(); final boolean isPathType = type.equals(PATH.getId()); getParameterType(type).appendParameter(isPathType ? sb2 : sb1, tv); } preferences.getOtherPreferences().toParameters(sb1); if (sb2.length() > 0) sb1.append(" --").append(sb2); return sb1.toString(); }  String build(Preferences preferences); }
LsofParametersBuilder { public String build(Preferences preferences) { final StringBuilder sb1 = new StringBuilder(COMMAND); final StringBuilder sb2 = new StringBuilder(); for (Filter tv : preferences.getFilters()) { final String type = tv.getType(); final boolean isPathType = type.equals(PATH.getId()); getParameterType(type).appendParameter(isPathType ? sb2 : sb1, tv); } preferences.getOtherPreferences().toParameters(sb1); if (sb2.length() > 0) sb1.append(" --").append(sb2); return sb1.toString(); }  String build(Preferences preferences);  }