aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2016-02-22 19:42:42 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2016-02-22 19:42:42 +0100
commit6e9accbad15f8485f8860a8afbb525c4a04dd278 (patch)
tree5cea3ba0a73a7c528ade1c65e263a3fee2d80b88 /sonar-plugin-api
parentd88d443bbe5c5dabe45b44760108fa7b506cd7d9 (diff)
downloadsonarqube-6e9accbad15f8485f8860a8afbb525c4a04dd278.tar.gz
sonarqube-6e9accbad15f8485f8860a8afbb525c4a04dd278.zip
Fix quality flaws
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtCharacteristic.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristic.java123
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristicTest.java80
3 files changed, 1 insertions, 204 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtCharacteristic.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtCharacteristic.java
index 261da4e87d7..52d9cd48a6d 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtCharacteristic.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtCharacteristic.java
@@ -29,7 +29,7 @@ import javax.annotation.CheckForNull;
public interface DebtCharacteristic {
/**
- * Only used when a characteristic is disabled (id is -1 in dto) by the user. see {@link org.sonar.server.rule.index.RuleNormalizer}
+ * Only used when a characteristic is disabled (id is -1 in dto) by the user.
*/
String NONE = "NONE";
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristic.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristic.java
deleted file mode 100644
index 4c6154e23bb..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristic.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.api.server.debt.internal;
-
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.server.debt.DebtCharacteristic;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import java.util.Date;
-
-/**
- * @since 4.3
- */
-public class DefaultDebtCharacteristic implements DebtCharacteristic {
-
- private Integer id;
- private String key;
- private String name;
- private Integer order;
- private Integer parentId;
- private Date createdAt;
- private Date updatedAt;
-
- public Integer id() {
- return id;
- }
-
- public DefaultDebtCharacteristic setId(Integer id) {
- this.id = id;
- return this;
- }
-
- @Override
- public String key() {
- return key;
- }
-
- public DefaultDebtCharacteristic setKey(String key) {
- this.key = key;
- return this;
- }
-
- @Override
- public String name() {
- return name;
- }
-
- public DefaultDebtCharacteristic setName(String name) {
- this.name = name;
- return this;
- }
-
- @Override
- @CheckForNull
- public Integer order() {
- return order;
- }
-
- public DefaultDebtCharacteristic setOrder(@Nullable Integer order) {
- this.order = order;
- return this;
- }
-
- @CheckForNull
- public Integer parentId() {
- return parentId;
- }
-
- public DefaultDebtCharacteristic setParentId(@Nullable Integer parentId) {
- this.parentId = parentId;
- return this;
- }
-
- public Date createdAt() {
- return createdAt;
- }
-
- public DefaultDebtCharacteristic setCreatedAt(Date createdAt) {
- this.createdAt = createdAt;
- return this;
- }
-
- @CheckForNull
- public Date updatedAt() {
- return updatedAt;
- }
-
- public DefaultDebtCharacteristic setUpdatedAt(@Nullable Date updatedAt) {
- this.updatedAt = updatedAt;
- return this;
- }
-
- @Override
- public boolean isSub(){
- return parentId != null;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
- }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristicTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristicTest.java
deleted file mode 100644
index dcaa96a8efb..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristicTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.api.server.debt.internal;
-
-import org.junit.Test;
-
-import java.util.Date;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class DefaultDebtCharacteristicTest {
-
- @Test
- public void setter_and_getter_on_characteristic() {
- DefaultDebtCharacteristic debtCharacteristic = new DefaultDebtCharacteristic()
- .setId(1)
- .setKey("PORTABILITY")
- .setName("Portability")
- .setOrder(1)
- .setCreatedAt(new Date())
- .setUpdatedAt(new Date());
-
- assertThat(debtCharacteristic.id()).isEqualTo(1);
- assertThat(debtCharacteristic.key()).isEqualTo("PORTABILITY");
- assertThat(debtCharacteristic.name()).isEqualTo("Portability");
- assertThat(debtCharacteristic.order()).isEqualTo(1);
- assertThat(debtCharacteristic.parentId()).isNull();
- assertThat(debtCharacteristic.isSub()).isFalse();
- assertThat(debtCharacteristic.createdAt()).isNotNull();
- assertThat(debtCharacteristic.updatedAt()).isNotNull();
- }
-
- @Test
- public void setter_and_getter_on_sub_characteristic() {
- DefaultDebtCharacteristic debtCharacteristic = new DefaultDebtCharacteristic()
- .setId(1)
- .setKey("COMPILER")
- .setName("Compiler")
- .setParentId(2)
- .setCreatedAt(new Date())
- .setUpdatedAt(new Date());
-
- assertThat(debtCharacteristic.id()).isEqualTo(1);
- assertThat(debtCharacteristic.key()).isEqualTo("COMPILER");
- assertThat(debtCharacteristic.name()).isEqualTo("Compiler");
- assertThat(debtCharacteristic.order()).isNull();
- assertThat(debtCharacteristic.parentId()).isEqualTo(2);
- assertThat(debtCharacteristic.isSub()).isTrue();
- assertThat(debtCharacteristic.createdAt()).isNotNull();
- assertThat(debtCharacteristic.updatedAt()).isNotNull();
- }
-
- @Test
- public void to_string() {
- assertThat(new DefaultDebtCharacteristic()
- .setId(1)
- .setKey("PORTABILITY")
- .setName("Portability")
- .setOrder(1)
- .setCreatedAt(new Date())
- .setUpdatedAt(new Date())).isNotNull();
- }
-}