Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ void setUp() {

context = mock(JavaFileScannerContext.class);
when(context.getInputFile()).thenReturn(INPUT_FILE);
when(context.getSemanticModel()).thenReturn(mock(Sema.class));
Sema sema = mock(Sema.class);
when(context.getSemanticModel()).thenReturn(sema);

fakeIssue = mock(FilterableIssue.class);
when(fakeIssue.componentKey()).thenReturn("component");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,8 @@ void add_issue_or_parse_error() {
InputFile inputFile = inputFileBuilder.build();
fileSystem.add(inputFile);

when(this.checks.ruleKey(any(JavaCheck.class))).thenReturn(mock(RuleKey.class));
RuleKey ruleKey = mock(RuleKey.class);
when(this.checks.ruleKey(any(JavaCheck.class))).thenReturn(ruleKey);

SonarComponents sonarComponents = new SonarComponents(fileLinesContextFactory, fileSystem, null,
null, checkFactory, specificContext.activeRules(), new CheckRegistrar[]{expectedRegistrar});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,8 @@ void successful_batch_mode_with_missing_analyzed_files_should_continue_file_by_f
JParserConfig config = spy(JParserConfig.Mode.BATCH
.create(MAXIMUM_SUPPORTED_JAVA_VERSION, List.of(), false));
// Return a lazy ASTParser that do nothing to ensure that we have not analyzed files
when(config.astParser()).thenReturn(mock(ASTParser.class));
ASTParser astParser = mock(ASTParser.class);
when(config.astParser()).thenReturn(astParser);

config.parse(inputFiles, () -> false, new AnalysisProgress(inputFiles.size()), doNothingAction);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,8 @@ void custom_file_scanner_is_not_filtered_in_autoscan() throws IOException {
.setType(InputFile.Type.MAIN).initMetadata(Files.readString(mainFile.toPath())).setCharset(UTF_8).build());

FileLinesContextFactory fileLinesContextFactory = mock(FileLinesContextFactory.class);
when(fileLinesContextFactory.createFor(any(InputFile.class))).thenReturn(mock(FileLinesContext.class));
FileLinesContext fileLinesContext = mock(FileLinesContext.class);
when(fileLinesContextFactory.createFor(any(InputFile.class))).thenReturn(fileLinesContext);
ClasspathForTest javaTestClasspath = new ClasspathForTest(context.config(), fs);
ClasspathForMain javaClasspath = new ClasspathForMain(context.config(), fs);
DefaultJavaResourceLocator resourceLocator = createDefaultJavaResourceLocator(context.config(), fs);
Expand Down Expand Up @@ -538,7 +539,8 @@ private SensorContextTester analyzeTwoFilesWithIssues(MapSettings settings) thro
.setType(InputFile.Type.TEST).initMetadata(Files.readString(testFile.toPath())).setCharset(UTF_8).build());

FileLinesContextFactory fileLinesContextFactory = mock(FileLinesContextFactory.class);
when(fileLinesContextFactory.createFor(any(InputFile.class))).thenReturn(mock(FileLinesContext.class));
FileLinesContext fileLinesContext = mock(FileLinesContext.class);
when(fileLinesContextFactory.createFor(any(InputFile.class))).thenReturn(fileLinesContext);
ClasspathForTest javaTestClasspath = new ClasspathForTest(context.config(), fs);
ClasspathForMain javaClasspath = new ClasspathForMain(context.config(), fs);
DefaultJavaResourceLocator resourceLocator = createDefaultJavaResourceLocator(context.config(), fs);
Expand Down
Loading