### Question:
ArgumentParser { public static Map<String, String> parseMap(String mapString, String description) { if (mapString == null || mapString.isEmpty()) { return ImmutableMap.of(); } ImmutableMap.Builder<String, String> result = ImmutableMap.builder(); List<String> tokens = Parser.parseInput(mapString); for (String token : tokens) { int firstEquals = token.indexOf('='); if (firstEquals > 0) { String key = token.substring(0, firstEquals); String value = token.substring(firstEquals + 1, token.length()); result.put(extractValue(key), extractValue(value)); } else { throw new IllegalArgumentException(description + " must be of the form 'key1=val1 key2=val2'"); } } return result.build(); }  static Map<String, String> parseMap(String mapString, String description); static Map<String, Integer> parseStringIntegerMap(String mapString, String description); static ProgramIdArgument parseProgramId(String programId); static Map<String, String> getArguments(String input, String pattern);  }### Answer:
@Test public void testParseMap() { String argValue = "^\\[(?<timestamp>%{DAY} \\s+ %{MONTHDAY} %{TIME} %{YEAR})\\]"; String mapString = "\"test\"='OXF' arg='" + argValue + "'"; Map<String, String> actual = ArgumentParser.parseMap(mapString, "<arguments>"); Assert.assertEquals("OXF", actual.get("test")); Assert.assertEquals(argValue, actual.get("arg")); }
@Test(expected = IllegalArgumentException.class) public void testParseInvalidMap() { Map<String, String> actual = ArgumentParser.parseMap("key1=value key2", "<arguments>"); }