use of org.sonarsource.sonarlint.core.serverapi.hotspot.GetSecurityHotspotRequestParams in project sonarlint-core by SonarSource.
the class ConnectedModeTest method canFetchHotspot.
@Test
public void canFetchHotspot() throws InvalidProtocolBufferException {
assumeTrue("SonarQube should support opening security hotspots", ORCHESTRATOR.getServer().version().isGreaterThanOrEquals(8, 6));
analyzeMavenProject(PROJECT_KEY_JAVA_HOTSPOT);
var securityHotspotsService = new ServerApi(endpointParams(ORCHESTRATOR), sqHttpClient()).hotspot();
var remoteHotspot = securityHotspotsService.fetch(new GetSecurityHotspotRequestParams(getFirstHotspotKey(PROJECT_KEY_JAVA_HOTSPOT), PROJECT_KEY_JAVA_HOTSPOT));
assertThat(remoteHotspot).isNotEmpty();
var actualHotspot = remoteHotspot.get();
assertThat(actualHotspot.message).isEqualTo("Make sure using this hardcoded IP address is safe here.");
assertThat(actualHotspot.filePath).isEqualTo("src/main/java/foo/Foo.java");
assertThat(actualHotspot.textRange).isEqualToComparingFieldByField(new TextRange(5, 14, 5, 29));
assertThat(actualHotspot.author).isEmpty();
assertThat(actualHotspot.status).isEqualTo(ServerHotspot.Status.TO_REVIEW);
assertThat(actualHotspot.resolution).isNull();
assertThat(actualHotspot.rule.key).isEqualTo("java:S1313");
}
Aggregations