class LsofParametersBuilder {

    public String build(Preferences preferences) {
        final StringBuilder sb1 = new StringBuilder(COMMAND);
        final StringBuilder sb2 = new StringBuilder(); // Path
        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();
    }

}

class LsofParametersBuilderTest  {

    private LsofParametersBuilder _builder;

    @Test
    public void createParametersForDefaultQueryPreferences() {

        checkLsofParameters("lsof -F -T +c0 -o -n -P", _builder.build(Preferences.from("dummyQuery")));
    }

}