From e0372972bea10819d0e4f04867e523a8460bcf51 Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Fri, 2 Sep 2016 14:06:49 +0200 Subject: [PATCH] SONAR-7722 The project name should not be mandatory --- .../java/org/sonar/api/batch/bootstrap/ProjectDefinition.java | 2 +- .../org/sonar/api/batch/bootstrap/ProjectDefinitionTest.java | 2 +- .../java/org/sonar/scanner/scan/ProjectReactorBuilderTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java index 95953da2422..aab2c11c278 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java @@ -208,7 +208,7 @@ public class ProjectDefinition { public String getName() { String name = properties.get(CoreProperties.PROJECT_NAME_PROPERTY); if (StringUtils.isBlank(name)) { - name = "Unnamed - " + getKey(); + name = getKey(); } return name; } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectDefinitionTest.java index 9cee607615c..94ddaa4cc40 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectDefinitionTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectDefinitionTest.java @@ -62,7 +62,7 @@ public class ProjectDefinitionTest { public void shouldSupportDefaultName() { ProjectDefinition def = ProjectDefinition.create(); def.setKey("myKey"); - assertThat(def.getName()).isEqualTo("Unnamed - myKey"); + assertThat(def.getName()).isEqualTo("myKey"); } @Test diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorBuilderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorBuilderTest.java index 84ad528f2df..6f7d8502e17 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorBuilderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorBuilderTest.java @@ -464,7 +464,7 @@ public class ProjectReactorBuilderTest { public void shouldAcceptNoProjectName() { ProjectDefinition rootProject = loadProjectDefinition("simple-project-with-missing-project-name"); assertThat(rootProject.getOriginalName()).isNull(); - assertThat(rootProject.getName()).isEqualTo("Unnamed - com.foo.project"); + assertThat(rootProject.getName()).isEqualTo("com.foo.project"); } @Test -- 2.39.5