提交 55caf7bd 编写于 作者: C Chris Beams

Improve diagnostics for invalid testGroup values

上级 1bdd081a
...@@ -21,6 +21,10 @@ import java.util.EnumSet; ...@@ -21,6 +21,10 @@ import java.util.EnumSet;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.springframework.util.StringUtils;
import static java.lang.String.*;
/** /**
* A test group used to limit when certain tests are run. * A test group used to limit when certain tests are run.
* *
...@@ -64,8 +68,10 @@ public enum TestGroup { ...@@ -64,8 +68,10 @@ public enum TestGroup {
try { try {
groups.add(valueOf(group.trim().toUpperCase())); groups.add(valueOf(group.trim().toUpperCase()));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Unable to find test group '" + group.trim() throw new IllegalArgumentException(format(
+ "' when parsing '" + value + "'"); "Unable to find test group '%s' when parsing testGroups value: '%s'. " +
"Available groups include: [%s]", group.trim(), value,
StringUtils.arrayToCommaDelimitedString(TestGroup.values())));
} }
} }
return groups; return groups;
......
...@@ -62,7 +62,9 @@ public class TestGroupTests { ...@@ -62,7 +62,9 @@ public class TestGroupTests {
@Test @Test
public void parseMissing() throws Exception { public void parseMissing() throws Exception {
thrown.expect(IllegalArgumentException.class); thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Unable to find test group 'missing' when parsing 'performance, missing'"); thrown.expectMessage("Unable to find test group 'missing' when parsing " +
"testGroups value: 'performance, missing'. Available groups include: " +
"[LONG_RUNNING,PERFORMANCE,JMXMP]");
TestGroup.parse("performance, missing"); TestGroup.parse("performance, missing");
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册