diff options
author | Martin Strecker <103252490+martin-strecker-sonarsource@users.noreply.github.com> | 2023-11-27 17:04:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-27 17:04:14 +0100 |
commit | a4f5865bd47587d1323ed34dd4325771732bb0be (patch) | |
tree | 4c9e05544aa1fe177924056372cd213ac2025174 | |
parent | 87b165c2e997f21f758162e0847bde16e139d7fd (diff) | |
download | sonarqube-a4f5865bd47587d1323ed34dd4325771732bb0be.tar.gz sonarqube-a4f5865bd47587d1323ed34dd4325771732bb0be.zip |
WIP: Add test
-rw-r--r-- | sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/symbol/internal/DefaultSymbolTableTest.java | 12 |
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(".*"); + } } |