net.thucydides.core.webdriver.OptionsMap Maven / Gradle / Ivy
package net.thucydides.core.webdriver;
import com.google.common.base.Splitter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by john on 14/07/2017.
*/
public class OptionsMap {
public static Map from(String options) {
List optionValues = Splitter.on(";").splitToList(options);
Map optionsMap = new HashMap();
for (String optionValue : optionValues) {
if (optionValue.contains("=")) {
int equalsSign = optionValue.indexOf("=");
String optionKey = optionValue.substring(0, equalsSign);
String optionKeyValue = optionValue.substring(equalsSign + 1);
optionsMap.put(optionKey, optionKeyValue);
}
}
return optionsMap;
}
}