### Question:
RuntimeArguments { public static Map<String, String> fromPosixArray(String[] args) { Map<String, String> kvMap = new HashMap<>(); for (String arg : args) { int idx = arg.indexOf('='); int keyOff = arg.startsWith("--") ? "--".length() : 0; String key = idx < 0 ? arg.substring(keyOff) : arg.substring(keyOff, idx); String value = idx < 0 ? "" : arg.substring(idx + 1); kvMap.put(key, value); } return kvMap; } private  RuntimeArguments(); static Map<String, String> fromPosixArray(String[] args); static String[] toPosixArray(Map<String, String> kvMap); static String[] toPosixArray(Iterable<Map.Entry<String, String>> iterable); static Map<String, String> extractScope(Scope scope, String name, Map<String, String> arguments); static Map<String, String> extractScope(String scope, String name, Map<String, String> arguments); static Map<String, String> addScope(Scope scope, String name, Map<String, String> arguments); static String addScope(Scope scope, String name, String argument); static String addScope(String scope, String name, String argument); static final Map<String, String> NO_ARGUMENTS; }### Answer:
@Test public void testStringtoMap() { String[] argArray = new String[] { "--key1=val1" , "--key2=val2", "--keyOnly"}; Map<String, String> expectedMap = new HashMap<>(); expectedMap.put("key1", "val1"); expectedMap.put("key2", "val2"); expectedMap.put("keyOnly", ""); Assert.assertEquals(expectedMap, RuntimeArguments.fromPosixArray(argArray)); }