uk.co.automatictester.wiremock.maven.plugin.util.ParameterUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wiremock-maven-plugin Show documentation
Show all versions of wiremock-maven-plugin Show documentation
Run WireMock as part of Maven lifecycle
package uk.co.automatictester.wiremock.maven.plugin.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ParameterUtil {
private ParameterUtil() {
}
private static final String ROOT_DIR_PARAM_PREFIX = "--root-dir=";
public static String[] getAllParams(String dir, String nonDirParams) {
List dirParam = Arrays.asList(getDirParam(dir));
List otherParams = getNonDirParams(nonDirParams);
List allParams = new ArrayList<>();
allParams.addAll(dirParam);
allParams.addAll(otherParams);
return allParams.toArray(new String[]{});
}
public static String[] getDirParam(String dir) {
List dirParam = new ArrayList<>();
dirParam.add(ROOT_DIR_PARAM_PREFIX + dir);
return dirParam.toArray(new String[]{});
}
private static List getNonDirParams(String nonDirParams) {
return getParamsFrom(nonDirParams);
}
private static List getParamsFrom(String paramString) {
String[] params = paramString.split(" ");
return Arrays.asList(params);
}
}