From 2c36dc6f775adbdbd6688a9329064ec0ff332941 Mon Sep 17 00:00:00 2001 From: Léo Geoffroy <99647462+leo-geoffroy-sonarsource@users.noreply.github.com> Date: Tue, 11 Oct 2022 09:23:16 +0200 Subject: SONAR-17412 minor fixes on log and tests (#6812) --- .../src/main/java/org/sonar/server/favorite/FavoriteUpdater.java | 4 ++-- .../src/test/java/org/sonar/server/favorite/FavoriteUpdaterTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'server/sonar-server-common') diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/favorite/FavoriteUpdater.java b/server/sonar-server-common/src/main/java/org/sonar/server/favorite/FavoriteUpdater.java index 2e27ce531f5..261bd7fee94 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/favorite/FavoriteUpdater.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/favorite/FavoriteUpdater.java @@ -51,7 +51,7 @@ public class FavoriteUpdater { .setUserUuid(userUuid) .setComponentUuid(componentDto.uuid()) .build(), dbSession); - checkArgument(existingFavoriteOnComponent.isEmpty(), "Component '%s' is already a favorite", componentDto.getKey()); + checkArgument(existingFavoriteOnComponent.isEmpty(), "Component '%s' (uuid: %s) is already a favorite", componentDto.getKey(), componentDto.uuid()); List existingFavorites = dbClient.propertiesDao().selectByKeyAndUserUuidAndComponentQualifier(dbSession, PROP_FAVORITE_KEY, userUuid, componentDto.qualifier()); if (existingFavorites.size() >= 100) { @@ -81,6 +81,6 @@ public class FavoriteUpdater { .setComponentUuid(component.uuid()) .setUserUuid(userUuid), userLogin, component.getKey(), component.name(), component.qualifier()); - checkArgument(result == 1, "Component '%s' is not a favorite", component.getKey()); + checkArgument(result == 1, "Component '%s' (uuid: %s) is not a favorite", component.getKey(), component.uuid()); } } diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/favorite/FavoriteUpdaterTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/favorite/FavoriteUpdaterTest.java index 3678a2656eb..8bcd228f662 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/favorite/FavoriteUpdaterTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/favorite/FavoriteUpdaterTest.java @@ -118,7 +118,7 @@ public class FavoriteUpdaterTest { assertThatThrownBy(() -> underTest.add(dbSession, project, user.getUuid(), user.getLogin(), true)) .isInstanceOf(IllegalArgumentException.class) - .hasMessage(String.format("Component '%s' is already a favorite", project.getKey())); + .hasMessage(String.format("Component '%s' (uuid: %s) is already a favorite", project.getKey(), project.uuid())); } private void assertFavorite(ComponentDto project, UserDto user) { -- cgit v1.2.3