diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2017-09-20 15:48:06 +0200 |
---|---|---|
committer | Duarte Meneses <duarte.meneses@sonarsource.com> | 2017-09-28 09:14:43 +0200 |
commit | 0a201a057cac9263b641614d5491d2061ab3ab80 (patch) | |
tree | 89106407f5351214a4259e8f1c9a4f3f20bd474c /sonar-scanner-engine/src/test/java/org | |
parent | e19f3f56fe2d8bc2101086b166ec4de92a5c3c8f (diff) | |
download | sonarqube-0a201a057cac9263b641614d5491d2061ab3ab80.tar.gz sonarqube-0a201a057cac9263b641614d5491d2061ab3ab80.zip |
Clean container
Diffstat (limited to 'sonar-scanner-engine/src/test/java/org')
4 files changed, 5 insertions, 90 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ComponentsPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ComponentsPublisherTest.java index 5ebfeb7e852..528aa5b968c 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ComponentsPublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ComponentsPublisherTest.java @@ -104,6 +104,7 @@ public class ComponentsPublisherTest { moduleHierarchy = mock(InputModuleHierarchy.class); when(moduleHierarchy.root()).thenReturn(root); when(moduleHierarchy.children(root)).thenReturn(Collections.singleton(module1)); + when(moduleHierarchy.parent(module1)).thenReturn(root); tree.index(module1, root); DefaultInputDir dir = new DefaultInputDir("module1", "src", 3); @@ -471,6 +472,7 @@ public class ComponentsPublisherTest { moduleHierarchy = mock(InputModuleHierarchy.class); when(moduleHierarchy.root()).thenReturn(root); when(moduleHierarchy.children(root)).thenReturn(Collections.singleton(module1)); + when(moduleHierarchy.parent(module1)).thenReturn(root); tree.index(module1, root); DefaultInputDir dir = new DefaultInputDir("module1", "src", 3); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorProviderTest.java deleted file mode 100644 index 5ebded1daec..00000000000 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorProviderTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.scanner.scan.filesystem; - -import java.io.IOException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.mockito.Mockito; -import org.sonar.api.batch.bootstrap.ProjectDefinition; -import org.sonar.api.batch.fs.internal.DefaultInputModule; -import org.sonar.api.batch.fs.internal.FileMetadata; -import org.sonar.scanner.issue.ignore.pattern.IssueExclusionPatternInitializer; -import org.sonar.scanner.issue.ignore.pattern.PatternMatcher; -import org.sonar.scanner.issue.ignore.scanner.IssueExclusionsLoader; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - -public class MetadataGeneratorProviderTest { - - @Rule - public TemporaryFolder temp = new TemporaryFolder(); - - @Test - public void create_builder() throws IOException { - StatusDetectionFactory statusDetectionFactory = mock(StatusDetectionFactory.class, Mockito.RETURNS_MOCKS); - IssueExclusionsLoader issueExclusionsLoader = new IssueExclusionsLoader(mock(IssueExclusionPatternInitializer.class), mock(PatternMatcher.class)); - - MetadataGeneratorProvider factory = new MetadataGeneratorProvider(); - assertThat(factory.provide(new DefaultInputModule(ProjectDefinition.create().setKey("module").setBaseDir(temp.newFolder()).setWorkDir(temp.newFolder())), - statusDetectionFactory, new FileMetadata(), issueExclusionsLoader)).isNotNull(); - } -} diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ModuleFileSystemInitializerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ModuleFileSystemInitializerTest.java index 0d915fb747f..c0173ebf09f 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ModuleFileSystemInitializerTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ModuleFileSystemInitializerTest.java @@ -48,7 +48,7 @@ public class ModuleFileSystemInitializerTest { File workDir = temp.newFolder("work"); ProjectDefinition module = ProjectDefinition.create().setBaseDir(baseDir).setWorkDir(workDir); - ModuleFileSystemInitializer initializer = new ModuleFileSystemInitializer(new DefaultInputModule(module), module); + ModuleFileSystemInitializer initializer = new ModuleFileSystemInitializer(new DefaultInputModule(module)); assertThat(logTester.logs(LoggerLevel.INFO)).contains("Base dir: " + baseDir.toPath().toAbsolutePath().toString()); assertThat(logTester.logs(LoggerLevel.INFO)).contains("Working dir: " + workDir.toPath().toAbsolutePath().toString()); @@ -73,7 +73,7 @@ public class ModuleFileSystemInitializerTest { .addSources("src/main/java", "src/main/unknown") .addTests("src/test/java", "src/test/unknown"); - ModuleFileSystemInitializer initializer = new ModuleFileSystemInitializer(new DefaultInputModule(project), project); + ModuleFileSystemInitializer initializer = new ModuleFileSystemInitializer(new DefaultInputModule(project)); assertThat(initializer.sources()).hasSize(1); assertThat(path(initializer.sources().get(0))).endsWith("src/main/java"); @@ -96,7 +96,7 @@ public class ModuleFileSystemInitializerTest { .addSources("\"my,File.cs\"") .addTests("\"my,TestFile.cs\""); - ModuleFileSystemInitializer initializer = new ModuleFileSystemInitializer(new DefaultInputModule(project), project); + ModuleFileSystemInitializer initializer = new ModuleFileSystemInitializer(new DefaultInputModule(project)); assertThat(initializer.sources()).hasSize(1); assertThat(initializer.sources().get(0)).isEqualTo(sourceFile.toPath()); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionFactoryTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionFactoryTest.java deleted file mode 100644 index 259b5e5a653..00000000000 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionFactoryTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.scanner.scan.filesystem; - -import org.junit.Test; -import org.sonar.scanner.repository.ProjectRepositories; -import org.sonar.scanner.scm.ScmChangedFiles; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - -public class StatusDetectionFactoryTest { - @Test - public void testCreate() throws Exception { - StatusDetectionFactory factory = new StatusDetectionFactory(mock(ProjectRepositories.class), mock(ScmChangedFiles.class)); - StatusDetection detection = factory.create(); - assertThat(detection).isNotNull(); - } -} |