Skip to content

Commit

Permalink
Don't use assumeTrue to not break the quality gate
Browse files Browse the repository at this point in the history
  • Loading branch information
henryju committed Mar 14, 2018
1 parent 4df6727 commit d151f02
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.junit.rules.TemporaryFolder;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assume.assumeTrue;

public class PathResolverTest {
@Rule
Expand Down Expand Up @@ -111,13 +110,15 @@ public void relative_path_for_not_normalized_dir_sub_level() throws IOException

@Test
public void relative_path_for_case_insensitive_fs() throws IOException {
assumeTrue(SystemUtils.IS_OS_WINDOWS);
PathResolver resolver = new PathResolver();
File rootDir = temp.newFolder();
File baseDir = new File(rootDir, "level1");
File file = new File(baseDir, "../Level1/dir/file.c");

assertThat(resolver.relativePath(baseDir, file)).isEqualTo("dir/file.c");
// To please the quality gate, don't use assumeTrue, or the test will be reported as skipped
if (SystemUtils.IS_OS_WINDOWS) {
PathResolver resolver = new PathResolver();
File rootDir = temp.newFolder();
File baseDir = new File(rootDir, "level1");
File file = new File(baseDir, "../Level1/dir/file.c");

assertThat(resolver.relativePath(baseDir, file)).isEqualTo("dir/file.c");
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,19 +629,21 @@ public void scanProjectWithSourceSymlink() {
// SONAR-6719
@Test
public void scanProjectWithWrongCase() {
assumeTrue(System2.INSTANCE.isOsWindows());
File projectDir = new File("src/test/resources/mediumtest/xoo/sample");
TaskResult result = tester
.newScanTask(new File(projectDir, "sonar-project.properties"))
.property("sonar.sources", "XOURCES")
.property("sonar.tests", "TESTX")
.execute();
// To please the quality gate, don't use assumeTrue, or the test will be reported as skipped
if (System2.INSTANCE.isOsWindows()) {
File projectDir = new File("src/test/resources/mediumtest/xoo/sample");
TaskResult result = tester
.newScanTask(new File(projectDir, "sonar-project.properties"))
.property("sonar.sources", "XOURCES")
.property("sonar.tests", "TESTX")
.execute();

assertThat(result.inputFiles()).hasSize(3);
assertThat(result.inputFiles()).extractingResultOf("relativePath").containsOnly(
"xources/hello/HelloJava.xoo",
"xources/hello/helloscala.xoo",
"testx/ClassOneTest.xoo");
assertThat(result.inputFiles()).hasSize(3);
assertThat(result.inputFiles()).extractingResultOf("relativePath").containsOnly(
"xources/hello/HelloJava.xoo",
"xources/hello/helloscala.xoo",
"testx/ClassOneTest.xoo");
}
}

@Test
Expand Down

0 comments on commit d151f02

Please sign in to comment.