aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/symbol/internal/DefaultSymbolTableTest.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/symbol/internal/DefaultSymbolTableTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/symbol/internal/DefaultSymbolTableTest.java
index 4997a11dd55..1f40ff3107c 100644
--- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/symbol/internal/DefaultSymbolTableTest.java
+++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/symbol/internal/DefaultSymbolTableTest.java
@@ -67,4 +67,16 @@ public class DefaultSymbolTableTest {
assertThat(referencesPerSymbol).hasSize(2);
}
+ @Test
+ public void should_fail_on_reference_overlaps_declaration() {
+ DefaultSymbolTable symbolTableBuilder = new DefaultSymbolTable(mock(SensorStorage.class))
+ .onFile(INPUT_FILE);
+ symbolTableBuilder = symbolTableBuilder
+ .newSymbol(1, 0, 1, 10);
+
+ assertThatThrownBy(() -> {
+ symbolTableBuilder.newReference(1, 0, 1, 10);
+ }).isInstanceOf(IllegalArgumentException.class)
+ .hasMessageMatching(".*");
+ }
}