@@ -42,6 +42,9 @@ class GoblintAnalysisTest {
4242 @ Mock
4343 GoblintConfWatcher goblintConfWatcher = mock (GoblintConfWatcher .class );
4444 GoblintAnalysis goblintAnalysis = new GoblintAnalysis (magpieServer , goblintServer , goblintService , gobPieConfiguration , goblintConfWatcher );
45+ // Mock the arguments (files and analysisConsumer) for calling the GoblintAnalyze.analyze method
46+ Collection <? extends Module > files = new ArrayDeque <>();
47+ AnalysisConsumer analysisConsumer = mock (AnalysisConsumer .class );
4548 @ SystemStub
4649 private SystemOut systemOut ;
4750
@@ -61,9 +64,6 @@ void analyzeFailed() {
6164 // Mock that the incremental analysis is turned off (TODO: not sure why this is checked in reanalyze?)
6265 when (gobPieConfiguration .useIncrementalAnalysis ()).thenReturn (true );
6366
64- // Mock the arguments for calling the goblintAnalyze.analyze method
65- Collection <? extends Module > files = new ArrayDeque <>();
66- AnalysisConsumer analysisConsumer = mock (AnalysisConsumer .class );
6767 goblintAnalysis .analyze (files , analysisConsumer , true );
6868
6969 // Verify that Analysis has failed
@@ -96,10 +96,7 @@ void abortAnalysis() throws IOException {
9696 // Mock that the incremental analysis is turned off (TODO: not sure why this is checked in reanalyze?)
9797 when (gobPieConfiguration .useIncrementalAnalysis ()).thenReturn (true );
9898
99- // Mock the arguments for calling the goblintAnalyze.analyze method
100- // And call the method twice
101- Collection <? extends Module > files = new ArrayDeque <>();
102- AnalysisConsumer analysisConsumer = mock (AnalysisConsumer .class );
99+ // Call analyze method twice
103100 goblintAnalysis .analyze (files , analysisConsumer , true );
104101 goblintAnalysis .analyze (files , analysisConsumer , true );
105102
@@ -132,11 +129,8 @@ void abortAnalysisFails() throws IOException {
132129
133130 // Mock that abortAnalysis throws an exception when called
134131 doThrow (new IOException ()).when (goblintServer ).abortAnalysis ();
135-
136- // Mock the arguments for calling the goblintAnalyze.analyze method
137- // And call the method twice
138- Collection <? extends Module > files = new ArrayDeque <>();
139- AnalysisConsumer analysisConsumer = mock (AnalysisConsumer .class );
132+
133+ // Call analyze method twice
140134 goblintAnalysis .analyze (files , analysisConsumer , true );
141135 goblintAnalysis .analyze (files , analysisConsumer , true );
142136
@@ -168,9 +162,6 @@ void preAnalyseTest() {
168162 // Mock that the incremental analysis is turned off (TODO: not sure why this is checked in reanalyze?)
169163 when (gobPieConfiguration .useIncrementalAnalysis ()).thenReturn (true );
170164
171- // Mock the arguments for calling the goblintAnalyze.analyze method
172- Collection <? extends Module > files = new ArrayDeque <>();
173- AnalysisConsumer analysisConsumer = mock (AnalysisConsumer .class );
174165 goblintAnalysis .analyze (files , analysisConsumer , true );
175166
176167 // Verify that preAnalysis was indeed called once
@@ -203,9 +194,6 @@ void preAnalyseEmpty() {
203194 // Mock that the incremental analysis is turned off (TODO: not sure why this is checked in reanalyze?)
204195 when (gobPieConfiguration .useIncrementalAnalysis ()).thenReturn (true );
205196
206- // Mock the arguments for calling the goblintAnalyze.analyze method
207- Collection <? extends Module > files = new ArrayDeque <>();
208- AnalysisConsumer analysisConsumer = mock (AnalysisConsumer .class );
209197 goblintAnalysis .analyze (files , analysisConsumer , true );
210198
211199 // Verify that preAnalysis was indeed called once
@@ -236,9 +224,6 @@ void preAnalyseNull() {
236224 // Mock that the incremental analysis is turned off (TODO: not sure why this is checked in reanalyze?)
237225 when (gobPieConfiguration .useIncrementalAnalysis ()).thenReturn (true );
238226
239- // Mock the arguments for calling the goblintAnalyze.analyze method
240- Collection <? extends Module > files = new ArrayDeque <>();
241- AnalysisConsumer analysisConsumer = mock (AnalysisConsumer .class );
242227 goblintAnalysis .analyze (files , analysisConsumer , true );
243228
244229 // Verify that preAnalysis was indeed called once
@@ -270,9 +255,6 @@ void preAnalyseError() {
270255 // Mock that the incremental analysis is turned off (TODO: not sure why this is checked in reanalyze?)
271256 when (gobPieConfiguration .useIncrementalAnalysis ()).thenReturn (true );
272257
273- // Mock the arguments for calling the goblintAnalyze.analyze method
274- Collection <? extends Module > files = new ArrayDeque <>();
275- AnalysisConsumer analysisConsumer = mock (AnalysisConsumer .class );
276258 goblintAnalysis .analyze (files , analysisConsumer , true );
277259
278260 // Verify that preAnalysis was indeed called once
0 commit comments