Skip to content

Commit 6efbce6

Browse files
committed
Complete analyzeFailed test
1 parent 03b5d7c commit 6efbce6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/test/java/GoblintAnalysisTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void analyzeFailed() {
4545
when(goblintConfWatcher.refreshGoblintConfig()).thenReturn(true);
4646

4747
// Mock that the analyses of Goblint have started and completed
48-
when(goblintService.analyze(new AnalyzeParams(false))).thenReturn(CompletableFuture.completedFuture(null));
48+
when(goblintService.analyze(new AnalyzeParams(false))).thenReturn(CompletableFuture.failedFuture(new Throwable(" Testing failed analysis")));
4949

5050
// Mock that the incremental analysis is turned off (TODO: not sure why this is checked in reanalyze?)
5151
when(gobPieConfiguration.useIncrementalAnalysis()).thenReturn(true);
@@ -58,7 +58,11 @@ void analyzeFailed() {
5858

5959
// Verify that Analysis has failed
6060
assertTrue(systemOut.getLines().anyMatch(line -> line.contains("---------------------- Analysis started ----------------------")));
61-
//assertTrue(systemOut.getLines().anyMatch(line -> line.contains("--------------------- Analysis failed ----------------------")));
61+
assertTrue(systemOut.getLines().anyMatch(line -> line.contains("--------------------- Analysis failed ----------------------")));
62+
63+
// Verify that user is notified about the failed analysis
64+
verify(magpieServer).forwardMessageToClient(new MessageParams(MessageType.Info, "GobPie started analyzing the code."));
65+
verify(magpieServer).forwardMessageToClient(new MessageParams(MessageType.Error, "GobPie failed to analyze the code:\n Testing failed analysis"));
6266
}
6367

6468

0 commit comments

Comments
 (0)