aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-04-06 21:08:53 +0200
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-04-06 21:08:53 +0200
commit3b2d595782dca303ed648b818f2810b0e4363de0 (patch)
tree80991dbdfbee9185706116934c31a5d022f4818f /sonar-plugin-api
parent06db9c31a773ce1b7bf31745c694590dde9d10c4 (diff)
downloadsonarqube-3b2d595782dca303ed648b818f2810b0e4363de0.tar.gz
sonarqube-3b2d595782dca303ed648b818f2810b0e4363de0.zip
fix quality flaws
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTester.java35
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/CeTaskBuilder_PostProjectAnalysisTaskTesterTest.java8
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ConditionBuilder_PostProjectAnalysisTaskTesterTest.java18
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTesterTest.java14
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ProjectBuilder_PostProjectAnalysisTaskTesterTest.java12
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/QualityGateBuilder_PostProjectAnalysisTaskTesterTest.java14
6 files changed, 50 insertions, 51 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTester.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTester.java
index 1abe451aca1..218247b433c 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTester.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTester.java
@@ -91,9 +91,10 @@ import static java.util.Objects.requireNonNull;
*/
@Beta
public class PostProjectAnalysisTaskTester {
- private static final String DATE_CAN_NOT_BE_NULL = "date can not be null";
- private static final String PROJECT_CAN_NOT_BE_NULL = "project can not be null";
- private static final String CE_TASK_CAN_NOT_BE_NULL = "ceTask can not be null";
+ private static final String DATE_CAN_NOT_BE_NULL = "date cannot be null";
+ private static final String PROJECT_CAN_NOT_BE_NULL = "project cannot be null";
+ private static final String CE_TASK_CAN_NOT_BE_NULL = "ceTask cannot be null";
+ private static final String STATUS_CAN_NOT_BE_NULL = "status cannot be null";
private final PostProjectAnalysisTask underTest;
@CheckForNull
@@ -106,7 +107,7 @@ public class PostProjectAnalysisTaskTester {
private QualityGate qualityGate;
private PostProjectAnalysisTaskTester(PostProjectAnalysisTask underTest) {
- this.underTest = requireNonNull(underTest, "PostProjectAnalysisTask instance can not be null");
+ this.underTest = requireNonNull(underTest, "PostProjectAnalysisTask instance cannot be null");
}
public static PostProjectAnalysisTaskTester of(PostProjectAnalysisTask underTest) {
@@ -191,8 +192,7 @@ public class PostProjectAnalysisTaskTester {
@Beta
public static final class CeTaskBuilder {
- private static final String ID_CAN_NOT_BE_NULL = "id can not be null";
- private static final String STATUS_CAN_NOT_BE_NULL = "status can not be null";
+ private static final String ID_CAN_NOT_BE_NULL = "id cannot be null";
@CheckForNull
private String id;
@@ -240,9 +240,9 @@ public class PostProjectAnalysisTaskTester {
@Beta
public static final class ProjectBuilder {
- private static final String UUID_CAN_NOT_BE_NULL = "uuid can not be null";
- private static final String KEY_CAN_NOT_BE_NULL = "key can not be null";
- private static final String NAME_CAN_NOT_BE_NULL = "name can not be null";
+ private static final String UUID_CAN_NOT_BE_NULL = "uuid cannot be null";
+ private static final String KEY_CAN_NOT_BE_NULL = "key cannot be null";
+ private static final String NAME_CAN_NOT_BE_NULL = "name cannot be null";
private String uuid;
private String key;
private String name;
@@ -301,9 +301,8 @@ public class PostProjectAnalysisTaskTester {
@Beta
public static final class QualityGateBuilder {
- private static final String ID_CAN_NOT_BE_NULL = "id can not be null";
- private static final String NAME_CAN_NOT_BE_NULL = "name can not be null";
- private static final String STATUS_CAN_NOT_BE_NULL = "status can not be null";
+ private static final String ID_CAN_NOT_BE_NULL = "id cannot be null";
+ private static final String NAME_CAN_NOT_BE_NULL = "name cannot be null";
private String id;
private String name;
@@ -330,7 +329,7 @@ public class PostProjectAnalysisTaskTester {
}
public QualityGateBuilder add(QualityGate.Condition condition) {
- conditions.add(requireNonNull(condition, "condition can not be null"));
+ conditions.add(requireNonNull(condition, "condition cannot be null"));
return this;
}
@@ -380,8 +379,8 @@ public class PostProjectAnalysisTaskTester {
@Beta
public static final class ConditionBuilder {
- private static final String METRIC_KEY_CAN_NOT_BE_NULL = "metricKey can not be null";
- private static final String OPERATOR_CAN_NOT_BE_NULL = "operator can not be null";
+ private static final String METRIC_KEY_CAN_NOT_BE_NULL = "metricKey cannot be null";
+ private static final String OPERATOR_CAN_NOT_BE_NULL = "operator cannot be null";
private String metricKey;
private QualityGate.Operator operator;
@@ -472,9 +471,9 @@ public class PostProjectAnalysisTaskTester {
public QualityGate.Condition build(final QualityGate.EvaluationStatus status, final String value) {
checkCommonProperties();
- requireNonNull(status, "status can not be null");
- checkArgument(status != QualityGate.EvaluationStatus.NO_VALUE, "status can not be NO_VALUE, use method buildNoValue() instead");
- requireNonNull(value, "value can not be null, use method buildNoValue() instead");
+ requireNonNull(status, STATUS_CAN_NOT_BE_NULL);
+ checkArgument(status != QualityGate.EvaluationStatus.NO_VALUE, "status cannot be NO_VALUE, use method buildNoValue() instead");
+ requireNonNull(value, "value cannot be null, use method buildNoValue() instead");
return new QualityGate.Condition() {
@Override
public QualityGate.EvaluationStatus getStatus() {
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/CeTaskBuilder_PostProjectAnalysisTaskTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/CeTaskBuilder_PostProjectAnalysisTaskTesterTest.java
index 4425b0f2281..f1f7178cffe 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/CeTaskBuilder_PostProjectAnalysisTaskTesterTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/CeTaskBuilder_PostProjectAnalysisTaskTesterTest.java
@@ -37,7 +37,7 @@ public class CeTaskBuilder_PostProjectAnalysisTaskTesterTest {
@Test
public void setId_throws_NPE_if_id_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("id can not be null");
+ expectedException.expectMessage("id cannot be null");
underTest.setId(null);
}
@@ -45,7 +45,7 @@ public class CeTaskBuilder_PostProjectAnalysisTaskTesterTest {
@Test
public void setStatus_throws_NPE_if_status_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("status can not be null");
+ expectedException.expectMessage("status cannot be null");
underTest.setStatus(null);
}
@@ -55,7 +55,7 @@ public class CeTaskBuilder_PostProjectAnalysisTaskTesterTest {
underTest.setStatus(SOME_STATUS);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("id can not be null");
+ expectedException.expectMessage("id cannot be null");
underTest.build();
}
@@ -65,7 +65,7 @@ public class CeTaskBuilder_PostProjectAnalysisTaskTesterTest {
underTest.setId(SOME_ID);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("status can not be null");
+ expectedException.expectMessage("status cannot be null");
underTest.build();
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ConditionBuilder_PostProjectAnalysisTaskTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ConditionBuilder_PostProjectAnalysisTaskTesterTest.java
index c6ab146015d..a5cfc43b52c 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ConditionBuilder_PostProjectAnalysisTaskTesterTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ConditionBuilder_PostProjectAnalysisTaskTesterTest.java
@@ -41,7 +41,7 @@ public class ConditionBuilder_PostProjectAnalysisTaskTesterTest {
@Test
public void setMetricKey_throws_NPE_if_operator_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("metricKey can not be null");
+ expectedException.expectMessage("metricKey cannot be null");
underTest.setMetricKey(null);
}
@@ -49,7 +49,7 @@ public class ConditionBuilder_PostProjectAnalysisTaskTesterTest {
@Test
public void setOperator_throws_NPE_if_operator_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("operator can not be null");
+ expectedException.expectMessage("operator cannot be null");
underTest.setOperator(null);
}
@@ -59,7 +59,7 @@ public class ConditionBuilder_PostProjectAnalysisTaskTesterTest {
underTest.setOperator(SOME_OPERATOR).setErrorThreshold(SOME_ERROR_THRESHOLD).setWarningThreshold(SOME_WARNING_THRESHOLD);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("metricKey can not be null");
+ expectedException.expectMessage("metricKey cannot be null");
underTest.buildNoValue();
}
@@ -69,7 +69,7 @@ public class ConditionBuilder_PostProjectAnalysisTaskTesterTest {
underTest.setMetricKey(SOME_METRIC_KEY).setErrorThreshold(SOME_ERROR_THRESHOLD).setWarningThreshold(SOME_WARNING_THRESHOLD);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("operator can not be null");
+ expectedException.expectMessage("operator cannot be null");
underTest.buildNoValue();
}
@@ -151,7 +151,7 @@ public class ConditionBuilder_PostProjectAnalysisTaskTesterTest {
initValidBuilder();
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("status can not be null");
+ expectedException.expectMessage("status cannot be null");
underTest.build(null, SOME_VALUE);
}
@@ -161,7 +161,7 @@ public class ConditionBuilder_PostProjectAnalysisTaskTesterTest {
initValidBuilder();
expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("status can not be NO_VALUE, use method buildNoValue() instead");
+ expectedException.expectMessage("status cannot be NO_VALUE, use method buildNoValue() instead");
underTest.build(QualityGate.EvaluationStatus.NO_VALUE, SOME_VALUE);
}
@@ -171,7 +171,7 @@ public class ConditionBuilder_PostProjectAnalysisTaskTesterTest {
initValidBuilder();
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("value can not be null, use method buildNoValue() instead");
+ expectedException.expectMessage("value cannot be null, use method buildNoValue() instead");
underTest.build(SOME_STATUS_BUT_NO_VALUE, null);
}
@@ -181,7 +181,7 @@ public class ConditionBuilder_PostProjectAnalysisTaskTesterTest {
underTest.setOperator(SOME_OPERATOR).setErrorThreshold(SOME_ERROR_THRESHOLD).setWarningThreshold(SOME_WARNING_THRESHOLD);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("metricKey can not be null");
+ expectedException.expectMessage("metricKey cannot be null");
underTest.build(SOME_STATUS_BUT_NO_VALUE, SOME_VALUE);
}
@@ -191,7 +191,7 @@ public class ConditionBuilder_PostProjectAnalysisTaskTesterTest {
underTest.setMetricKey(SOME_METRIC_KEY).setErrorThreshold(SOME_ERROR_THRESHOLD).setWarningThreshold(SOME_WARNING_THRESHOLD);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("operator can not be null");
+ expectedException.expectMessage("operator cannot be null");
underTest.build(SOME_STATUS_BUT_NO_VALUE, SOME_VALUE);
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTesterTest.java
index 320a3349e2c..3b1eddb7a74 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTesterTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTesterTest.java
@@ -43,7 +43,7 @@ public class PostProjectAnalysisTaskTesterTest {
@Test
public void of_throws_NPE_if_PostProjectAnalysisTask_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("PostProjectAnalysisTask instance can not be null");
+ expectedException.expectMessage("PostProjectAnalysisTask instance cannot be null");
PostProjectAnalysisTaskTester.of(null);
}
@@ -51,7 +51,7 @@ public class PostProjectAnalysisTaskTesterTest {
@Test
public void withCeTask_throws_NPE_if_ceTask_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("ceTask can not be null");
+ expectedException.expectMessage("ceTask cannot be null");
underTest.withCeTask(null);
}
@@ -59,7 +59,7 @@ public class PostProjectAnalysisTaskTesterTest {
@Test
public void withProject_throws_NPE_if_project_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("project can not be null");
+ expectedException.expectMessage("project cannot be null");
underTest.withProject(null);
}
@@ -67,7 +67,7 @@ public class PostProjectAnalysisTaskTesterTest {
@Test
public void at_throws_NPE_if_date_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("date can not be null");
+ expectedException.expectMessage("date cannot be null");
underTest.at(null);
}
@@ -82,7 +82,7 @@ public class PostProjectAnalysisTaskTesterTest {
underTest.withProject(project).at(someDate);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("ceTask can not be null");
+ expectedException.expectMessage("ceTask cannot be null");
underTest.execute();
}
@@ -92,7 +92,7 @@ public class PostProjectAnalysisTaskTesterTest {
underTest.withCeTask(ceTask).at(someDate);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("project can not be null");
+ expectedException.expectMessage("project cannot be null");
underTest.execute();
}
@@ -130,7 +130,7 @@ public class PostProjectAnalysisTaskTesterTest {
underTest.withCeTask(ceTask).withProject(project);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("date can not be null");
+ expectedException.expectMessage("date cannot be null");
underTest.execute();
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ProjectBuilder_PostProjectAnalysisTaskTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ProjectBuilder_PostProjectAnalysisTaskTesterTest.java
index 25bc2d4614d..5536c0e8d2b 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ProjectBuilder_PostProjectAnalysisTaskTesterTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ProjectBuilder_PostProjectAnalysisTaskTesterTest.java
@@ -38,7 +38,7 @@ public class ProjectBuilder_PostProjectAnalysisTaskTesterTest {
@Test
public void setKey_throws_NPE_if_key_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("key can not be null");
+ expectedException.expectMessage("key cannot be null");
underTest.setKey(null);
}
@@ -46,7 +46,7 @@ public class ProjectBuilder_PostProjectAnalysisTaskTesterTest {
@Test
public void setName_throws_NPE_if_name_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("name can not be null");
+ expectedException.expectMessage("name cannot be null");
underTest.setName(null);
}
@@ -54,7 +54,7 @@ public class ProjectBuilder_PostProjectAnalysisTaskTesterTest {
@Test
public void setUuid_throws_NPE_if_uuid_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("uuid can not be null");
+ expectedException.expectMessage("uuid cannot be null");
underTest.setUuid(null);
}
@@ -64,7 +64,7 @@ public class ProjectBuilder_PostProjectAnalysisTaskTesterTest {
underTest.setUuid(SOME_UUID).setName(SOME_NAME);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("key can not be null");
+ expectedException.expectMessage("key cannot be null");
underTest.build();
}
@@ -74,7 +74,7 @@ public class ProjectBuilder_PostProjectAnalysisTaskTesterTest {
underTest.setUuid(SOME_UUID).setKey(SOME_KEY);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("name can not be null");
+ expectedException.expectMessage("name cannot be null");
underTest.build();
@@ -85,7 +85,7 @@ public class ProjectBuilder_PostProjectAnalysisTaskTesterTest {
underTest.setKey(SOME_KEY).setName(SOME_NAME);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("uuid can not be null");
+ expectedException.expectMessage("uuid cannot be null");
underTest.build();
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/QualityGateBuilder_PostProjectAnalysisTaskTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/QualityGateBuilder_PostProjectAnalysisTaskTesterTest.java
index 61a466b372e..847b9a3cf69 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/QualityGateBuilder_PostProjectAnalysisTaskTesterTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/QualityGateBuilder_PostProjectAnalysisTaskTesterTest.java
@@ -42,7 +42,7 @@ public class QualityGateBuilder_PostProjectAnalysisTaskTesterTest {
@Test
public void setId_throws_NPE_if_id_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("id can not be null");
+ expectedException.expectMessage("id cannot be null");
underTest.setId(null);
}
@@ -50,7 +50,7 @@ public class QualityGateBuilder_PostProjectAnalysisTaskTesterTest {
@Test
public void setStatus_throws_NPE_if_status_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("status can not be null");
+ expectedException.expectMessage("status cannot be null");
underTest.setStatus(null);
}
@@ -58,7 +58,7 @@ public class QualityGateBuilder_PostProjectAnalysisTaskTesterTest {
@Test
public void setName_throws_NPE_if_name_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("name can not be null");
+ expectedException.expectMessage("name cannot be null");
underTest.setName(null);
}
@@ -66,7 +66,7 @@ public class QualityGateBuilder_PostProjectAnalysisTaskTesterTest {
@Test
public void addCondition_throws_NPE_if_condition_is_null() {
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("condition can not be null");
+ expectedException.expectMessage("condition cannot be null");
underTest.add(null);
}
@@ -92,7 +92,7 @@ public class QualityGateBuilder_PostProjectAnalysisTaskTesterTest {
underTest.setStatus(SOME_STATUS).setName(SOME_NAME);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("id can not be null");
+ expectedException.expectMessage("id cannot be null");
underTest.build();
}
@@ -102,7 +102,7 @@ public class QualityGateBuilder_PostProjectAnalysisTaskTesterTest {
underTest.setId(SOME_ID).setName(SOME_NAME);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("status can not be null");
+ expectedException.expectMessage("status cannot be null");
underTest.build();
}
@@ -112,7 +112,7 @@ public class QualityGateBuilder_PostProjectAnalysisTaskTesterTest {
underTest.setId(SOME_ID).setStatus(SOME_STATUS);
expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("name can not be null");
+ expectedException.expectMessage("name cannot be null");
underTest.build();
}