From: Martin Strecker <103252490+martin-strecker-sonarsource@users.noreply.github.com> Date: Mon, 27 Nov 2023 16:04:14 +0000 (+0100) Subject: WIP: Add test X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a4f5865bd47587d1323ed34dd4325771732bb0be;p=sonarqube.git WIP: Add test --- 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(".*"); + } }