@@ -35,17 +35,13 @@ class GoblintAnalysisTest {
3535 MagpieServer magpieServer = mock (MagpieServer .class );
3636 @ Mock
3737 GoblintService goblintService = mock (GoblintService .class );
38-
3938 @ Mock
4039 GobPieConfiguration gobPieConfiguration = mock (GobPieConfiguration .class );
41-
4240 @ Spy
4341 GoblintServer goblintServer = spy (new GoblintServer (magpieServer , gobPieConfiguration ));
4442 @ Mock
4543 GoblintConfWatcher goblintConfWatcher = mock (GoblintConfWatcher .class );
46-
4744 GoblintAnalysis goblintAnalysis = new GoblintAnalysis (magpieServer , goblintServer , goblintService , gobPieConfiguration , goblintConfWatcher );
48-
4945 @ SystemStub
5046 private SystemOut systemOut ;
5147
@@ -66,10 +62,9 @@ void analyzeFailed() {
6662 when (gobPieConfiguration .useIncrementalAnalysis ()).thenReturn (true );
6763
6864 // Mock the arguments for calling the goblintAnalyze.analyze method
69- // And call the method twice
7065 Collection <? extends Module > files = new ArrayDeque <>();
7166 AnalysisConsumer analysisConsumer = mock (AnalysisConsumer .class );
72- goblintAnalysis .analyze (files , null , true );
67+ goblintAnalysis .analyze (files , analysisConsumer , true );
7368
7469 // Verify that Analysis has failed
7570 assertTrue (systemOut .getLines ().anyMatch (line -> line .contains ("---------------------- Analysis started ----------------------" )));
@@ -135,18 +130,16 @@ void abortAnalysisFails() throws IOException {
135130 // Mock that the incremental analysis is turned off (TODO: not sure why this is checked in reanalyze?)
136131 when (gobPieConfiguration .useIncrementalAnalysis ()).thenReturn (true );
137132
138- //Throwable IOException = new Throwable(java.io.IOException);
139- //when(goblintServer.abortAnalysis()).thenThrow(IOException);
140-
133+ // Mock that abortAnalysis throws an exception when called
141134 doThrow (new IOException ()).when (goblintServer ).abortAnalysis ();
135+
142136 // Mock the arguments for calling the goblintAnalyze.analyze method
143137 // And call the method twice
144138 Collection <? extends Module > files = new ArrayDeque <>();
145139 AnalysisConsumer analysisConsumer = mock (AnalysisConsumer .class );
146140 goblintAnalysis .analyze (files , analysisConsumer , true );
147141 goblintAnalysis .analyze (files , analysisConsumer , true );
148142
149-
150143 // Verify that abortAnalysis was indeed called once
151144 verify (goblintServer ).abortAnalysis ();
152145 assertTrue (systemOut .getLines ().anyMatch (line -> line .contains ("Aborting analysis failed." )));
0 commit comments