diff --git a/spring-core/src/test/java/org/springframework/tests/TestGroup.java b/spring-core/src/test/java/org/springframework/tests/TestGroup.java index dcc376eea4..7bd0ccdfd5 100644 --- a/spring-core/src/test/java/org/springframework/tests/TestGroup.java +++ b/spring-core/src/test/java/org/springframework/tests/TestGroup.java @@ -21,6 +21,10 @@ import java.util.EnumSet; import java.util.HashSet; 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. * @@ -64,8 +68,10 @@ public enum TestGroup { try { groups.add(valueOf(group.trim().toUpperCase())); } catch (IllegalArgumentException e) { - throw new IllegalArgumentException("Unable to find test group '" + group.trim() - + "' when parsing '" + value + "'"); + throw new IllegalArgumentException(format( + "Unable to find test group '%s' when parsing testGroups value: '%s'. " + + "Available groups include: [%s]", group.trim(), value, + StringUtils.arrayToCommaDelimitedString(TestGroup.values()))); } } return groups; diff --git a/spring-core/src/test/java/org/springframework/tests/TestGroupTests.java b/spring-core/src/test/java/org/springframework/tests/TestGroupTests.java index 2b4860fd72..7f9fe924c4 100644 --- a/spring-core/src/test/java/org/springframework/tests/TestGroupTests.java +++ b/spring-core/src/test/java/org/springframework/tests/TestGroupTests.java @@ -62,7 +62,9 @@ public class TestGroupTests { @Test public void parseMissing() throws Exception { 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"); }