diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-10-12 17:55:48 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-10-13 12:13:11 +0200 |
commit | aa2ddb09aaaccda72d510ae260e2cc027caa4583 (patch) | |
tree | 0c1c9917d6dc3475835b7fdc7bd9d3696ce92f21 /sonar-plugin-api/src | |
parent | 2d2d1a2b81d8b7e4cad5694e6468b41d30ebdd60 (diff) | |
download | sonarqube-aa2ddb09aaaccda72d510ae260e2cc027caa4583.tar.gz sonarqube-aa2ddb09aaaccda72d510ae260e2cc027caa4583.zip |
Improve error message of empty group name
Diffstat (limited to 'sonar-plugin-api/src')
3 files changed, 7 insertions, 7 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/user/UserGroupValidation.java b/sonar-plugin-api/src/main/java/org/sonar/api/user/UserGroupValidation.java index d3297231b3e..57a94414e0a 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/user/UserGroupValidation.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/user/UserGroupValidation.java @@ -33,7 +33,7 @@ public class UserGroupValidation { } public static void validateGroupName(String groupName) { - checkArgument(!isNullOrEmpty(groupName) && groupName.trim().length() > 0, "Group cannot contain empty group name"); + checkArgument(!isNullOrEmpty(groupName) && groupName.trim().length() > 0, "Group name cannot be empty"); checkArgument(groupName.length() <= GROUP_NAME_MAX_LENGTH, "Group name cannot be longer than %s characters", GROUP_NAME_MAX_LENGTH); checkArgument(!DefaultGroups.isAnyone(groupName), "Anyone group cannot be used"); } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/authentication/UserIdentityTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/authentication/UserIdentityTest.java index 8366dcc1549..00c2a9b69a7 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/server/authentication/UserIdentityTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/authentication/UserIdentityTest.java @@ -208,7 +208,7 @@ public class UserIdentityTest { @Test public void fail_when_groups_contain_empty_group_name() throws Exception { thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Group cannot contain empty group name"); + thrown.expectMessage("Group name cannot be empty"); UserIdentity.builder() .setProviderLogin("john") @@ -221,7 +221,7 @@ public class UserIdentityTest { @Test public void fail_when_groups_contain_only_blank_space() throws Exception { thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Group cannot contain empty group name"); + thrown.expectMessage("Group name cannot be empty"); UserIdentity.builder() .setProviderLogin("john") @@ -234,7 +234,7 @@ public class UserIdentityTest { @Test public void fail_when_groups_contain_null_group_name() throws Exception { thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Group cannot contain empty group name"); + thrown.expectMessage("Group name cannot be empty"); UserIdentity.builder() .setProviderLogin("john") diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/user/UserGroupValidationTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/user/UserGroupValidationTest.java index e952c7df7a9..30fdd8b7235 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/user/UserGroupValidationTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/user/UserGroupValidationTest.java @@ -40,7 +40,7 @@ public class UserGroupValidationTest { @Test public void fail_when_group_name_is_empty() throws Exception { thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Group cannot contain empty group name"); + thrown.expectMessage("Group name cannot be empty"); UserGroupValidation.validateGroupName(""); } @@ -48,7 +48,7 @@ public class UserGroupValidationTest { @Test public void fail_when_group_name_contains_only_blank() throws Exception { thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Group cannot contain empty group name"); + thrown.expectMessage("Group name cannot be empty"); UserGroupValidation.validateGroupName(" "); } @@ -64,7 +64,7 @@ public class UserGroupValidationTest { @Test public void fail_when_group_name_is_null() throws Exception { thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Group cannot contain empty group name"); + thrown.expectMessage("Group name cannot be empty"); UserGroupValidation.validateGroupName(null); } |