From 98804f23eb87a1c091c324034277404cb4021ada Mon Sep 17 00:00:00 2001 From: Michal Zgliczynski Date: Wed, 18 Dec 2024 10:00:38 +0100 Subject: [PATCH] Add mocks for .getTelemetry --- .../analysis/JavaScriptEslintBasedSensorTest.java | 3 +++ .../sonar/plugins/javascript/analysis/JsTsSensorTest.java | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/sonar-plugin/sonar-javascript-plugin/src/test/java/org/sonar/plugins/javascript/analysis/JavaScriptEslintBasedSensorTest.java b/sonar-plugin/sonar-javascript-plugin/src/test/java/org/sonar/plugins/javascript/analysis/JavaScriptEslintBasedSensorTest.java index 6c06b2a9152..cc36ef4a6f0 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/test/java/org/sonar/plugins/javascript/analysis/JavaScriptEslintBasedSensorTest.java +++ b/sonar-plugin/sonar-javascript-plugin/src/test/java/org/sonar/plugins/javascript/analysis/JavaScriptEslintBasedSensorTest.java @@ -148,6 +148,9 @@ public void setUp() throws Exception { ); tsProgram = new TsProgram("", new ArrayList<>(), List.of()); when(bridgeServerMock.createProgram(any())).thenReturn(tsProgram); + when(bridgeServerMock.getTelemetry()).thenReturn( + new TelemetryData(List.of(), new RuntimeTelemetry(Version.create(22, 9), "host")) + ); context = SensorContextTester.create(baseDir); context.fileSystem().setWorkDir(workDir); context.setRuntime( diff --git a/sonar-plugin/sonar-javascript-plugin/src/test/java/org/sonar/plugins/javascript/analysis/JsTsSensorTest.java b/sonar-plugin/sonar-javascript-plugin/src/test/java/org/sonar/plugins/javascript/analysis/JsTsSensorTest.java index bb4da3c1732..f55ebb58e07 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/test/java/org/sonar/plugins/javascript/analysis/JsTsSensorTest.java +++ b/sonar-plugin/sonar-javascript-plugin/src/test/java/org/sonar/plugins/javascript/analysis/JsTsSensorTest.java @@ -152,6 +152,12 @@ public void setUp() throws Exception { when(bridgeServerMock.isAlive()).thenReturn(true); when(bridgeServerMock.analyzeTypeScript(any())).thenReturn(new AnalysisResponse()); when(bridgeServerMock.getCommandInfo()).thenReturn("bridgeServerMock command info"); + when(bridgeServerMock.getTelemetry()).thenReturn( + new BridgeServer.TelemetryData( + List.of(), + new BridgeServer.RuntimeTelemetry(Version.create(22, 9), "host") + ) + ); when(bridgeServerMock.loadTsConfig(any())).thenAnswer(invocationOnMock -> { String tsConfigPath = (String) invocationOnMock.getArguments()[0]; FilePredicates predicates = context.fileSystem().predicates();