### Question:
NameParser { static List<Object> parseParameters(String string) { if (string == null || "".equals(string)) return Collections.emptyList(); if (!commaSeparatedDoubles.matcher(string).matches()) { throw new IllegalArgumentException("Arguments must be a comma separated list of double values (was " + string + ")"); } Matcher matcher = doubleParameter.matcher(string); List<Object> parameters = new ArrayList<Object>(); while (matcher.find()) { String parameter = matcher.group(); Double value = Double.parseDouble(parameter); parameters.add(value); } return parameters; }    }### Answer:
@Test public void testParameterParsing() { List<Object> parameters = NameParser.parseParameters("1.0,2.0"); assertThat(parameters, equalTo(Arrays.asList((Object) 1.0, 2.0))); parameters = NameParser.parseParameters("-1,.5, 23.25"); assertThat(parameters, equalTo(Arrays.asList((Object) (-1.0), 0.5, 23.25))); }
@Test(expected=IllegalArgumentException.class) public void testError1() { NameParser.parseParameters("1.0 2.0"); }
@Test(expected=IllegalArgumentException.class) public void testError2() { NameParser.parseParameters("1.O"); }
@Test(expected=IllegalArgumentException.class) public void testError3() { NameParser.parseParameters("1.1.2"); }