Skip to content

Commit f8b3e8b

Browse files
committed
Check for analysis finished in preAnalyseNull test
1 parent 941741d commit f8b3e8b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/test/java/GoblintAnalysisTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,14 @@ void preAnalyseNull() {
202202
doReturn(true).when(goblintServer).isAlive();
203203
when(goblintConfWatcher.refreshGoblintConfig()).thenReturn(true);
204204

205+
// Mock that Goblint returns some messages
206+
when(goblintService.messages()).thenReturn(CompletableFuture.completedFuture(new ArrayList<>()));
207+
205208
// Mock that the command to execute is null
206209
when(gobPieConfiguration.getPreAnalyzeCommand()).thenReturn(null);
207210

208211
// Mock that the analyses of Goblint have started and completed
209-
when(goblintService.analyze(new AnalyzeParams(false))).thenReturn(CompletableFuture.completedFuture(null));
212+
when(goblintService.analyze(new AnalyzeParams(false))).thenReturn(CompletableFuture.completedFuture(new GoblintAnalysisResult()));
210213

211214
// Mock that the incremental analysis is turned off (TODO: not sure why this is checked in reanalyze?)
212215
when(gobPieConfiguration.useIncrementalAnalysis()).thenReturn(true);
@@ -219,6 +222,7 @@ void preAnalyseNull() {
219222
// Verify that preAnalysis was indeed called once
220223
verify(goblintServer).preAnalyse();
221224
verify(magpieServer).forwardMessageToClient(new MessageParams(MessageType.Info, "GobPie started analyzing the code."));
225+
verify(magpieServer).forwardMessageToClient(new MessageParams(MessageType.Info, "GobPie finished analyzing the code."));
222226
}
223227

224228
@Test

0 commit comments

Comments
 (0)