Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
242 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DefaultInputModuleTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* SonarQube | ||
* Copyright (C) 2009-2018 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.api.batch.fs.internal; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.nio.charset.Charset; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.TemporaryFolder; | ||
import org.sonar.api.batch.bootstrap.ProjectDefinition; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class DefaultInputModuleTest { | ||
|
||
private static final String FILE_1 = "file1"; | ||
private static final String TEST_1 = "test1"; | ||
@Rule | ||
public TemporaryFolder temp = new TemporaryFolder(); | ||
|
||
@Test | ||
public void testGetters() throws IOException { | ||
ProjectDefinition def = ProjectDefinition.create(); | ||
def.setKey("moduleKey"); | ||
File baseDir = temp.newFolder(); | ||
Path src = baseDir.toPath().resolve(FILE_1); | ||
Files.createFile(src); | ||
Path test = baseDir.toPath().resolve(TEST_1); | ||
Files.createFile(test); | ||
def.setBaseDir(baseDir); | ||
File workDir = temp.newFolder(); | ||
def.setWorkDir(workDir); | ||
def.setSources(FILE_1); | ||
def.setTests(TEST_1); | ||
DefaultInputModule module = new DefaultInputModule(def); | ||
|
||
assertThat(module.key()).isEqualTo("moduleKey"); | ||
assertThat(module.definition()).isEqualTo(def); | ||
assertThat(module.getBranch()).isNull(); | ||
assertThat(module.getBaseDir()).isEqualTo(baseDir.toPath()); | ||
assertThat(module.getKeyWithBranch()).isEqualTo("moduleKey"); | ||
assertThat(module.getWorkDir()).isEqualTo(workDir.toPath()); | ||
assertThat(module.getEncoding()).isEqualTo(Charset.defaultCharset()); | ||
assertThat(module.getSourceDirsOrFiles()).containsExactlyInAnyOrder(src); | ||
assertThat(module.getTestDirsOrFiles()).containsExactlyInAnyOrder(test); | ||
assertThat(module.getEncoding()).isEqualTo(Charset.defaultCharset()); | ||
|
||
assertThat(module.isFile()).isFalse(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.