aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api-impl
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-plugin-api-impl')
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssue.java5
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRule.java5
-rw-r--r--sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssueTest.java8
-rw-r--r--sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRuleTest.java8
4 files changed, 12 insertions, 14 deletions
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssue.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssue.java
index 42418950a25..c12df1015e4 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssue.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssue.java
@@ -102,7 +102,7 @@ public class DefaultExternalIssue extends AbstractDefaultIssue<DefaultExternalIs
@CheckForNull
@Override
public CodeCharacteristic characteristic() {
- throw new IllegalStateException("Not implemented yet");
+ return null;
}
@Override
@@ -140,7 +140,8 @@ public class DefaultExternalIssue extends AbstractDefaultIssue<DefaultExternalIs
@Override
public NewExternalIssue characteristic(CodeCharacteristic characteristic) {
- throw new IllegalStateException("Not implemented yet");
+ // no op
+ return this;
}
}
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRule.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRule.java
index 52a243b8fca..6ececae895f 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRule.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRule.java
@@ -98,7 +98,7 @@ public class DefaultAdHocRule extends DefaultStorable implements AdHocRule, NewA
@CheckForNull
@Override
public CodeCharacteristic characteristic() {
- throw new IllegalStateException("Not implemented yet");
+ return null;
}
@Override
@@ -133,7 +133,8 @@ public class DefaultAdHocRule extends DefaultStorable implements AdHocRule, NewA
@Override
public NewAdHocRule characteristic(CodeCharacteristic characteristic) {
- throw new IllegalStateException("Not implemented yet");
+ // no op
+ return this;
}
}
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssueTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssueTest.java
index 0a71d62ef34..4b48ec35902 100644
--- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssueTest.java
+++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssueTest.java
@@ -54,7 +54,6 @@ public class DefaultExternalIssueTest {
.setWorkDir(temp.newFolder()));
}
-
private DefaultInputFile inputFile = new TestInputFileBuilder("foo", "src/Foo.php")
.initMetadata("Foo\nBar\n")
.build();
@@ -166,11 +165,10 @@ public class DefaultExternalIssueTest {
}
@Test
- public void characteristic_shouldThrowIllegalStateException() {
+ public void characteristic_shouldBeNoOp() {
SensorStorage storage = mock(SensorStorage.class);
DefaultExternalIssue issue = new DefaultExternalIssue(project, storage);
- assertThatThrownBy(issue::characteristic).isInstanceOf(IllegalStateException.class);
- assertThatThrownBy(() -> issue.characteristic(CodeCharacteristic.CLEAR)).isInstanceOf(IllegalStateException.class);
+ issue.characteristic(CodeCharacteristic.ROBUST);
+ assertThat(issue.characteristic()).isNull();
}
-
}
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRuleTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRuleTest.java
index 2e8036cc336..e46406b27e4 100644
--- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRuleTest.java
+++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRuleTest.java
@@ -56,7 +56,6 @@ public class DefaultAdHocRuleTest {
verify(storage).store(any(DefaultAdHocRule.class));
}
-
@Test
public void description_is_optional() {
SensorStorage storage = mock(SensorStorage.class);
@@ -119,7 +118,6 @@ public class DefaultAdHocRuleTest {
.hasMessageContaining("Name is mandatory");
}
-
@Test
public void fail_to_store_if_no_severity() {
SensorStorage storage = mock(SensorStorage.class);
@@ -151,10 +149,10 @@ public class DefaultAdHocRuleTest {
}
@Test
- public void characteristic_shouldThrowIllegalStateException() {
+ public void characteristic_shouldBeNoOp() {
SensorStorage storage = mock(SensorStorage.class);
DefaultAdHocRule rule = new DefaultAdHocRule(storage);
- assertThatThrownBy(() -> rule.characteristic(CodeCharacteristic.CLEAR)).isInstanceOf(IllegalStateException.class);
- assertThatThrownBy(() -> rule.characteristic()).isInstanceOf(IllegalStateException.class);
+ rule.characteristic(CodeCharacteristic.CLEAR);
+ assertThat(rule.characteristic()).isNull();
}
}