From aa2ddb09aaaccda72d510ae260e2cc027caa4583 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 12 Oct 2016 17:55:48 +0200 Subject: [PATCH] Improve error message of empty group name --- .../main/java/org/sonar/api/user/UserGroupValidation.java | 2 +- .../sonar/api/server/authentication/UserIdentityTest.java | 6 +++--- .../java/org/sonar/api/user/UserGroupValidationTest.java | 6 +++--- 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); } -- 2.39.5