From 4acb44301b09b1af2fa8118b888bd9cec415e463 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Sun, 14 Apr 2013 14:39:12 +0200 Subject: [PATCH] Fix execution of unit test on Windows --- .../scan/filesystem/ModuleFileSystemProviderTest.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ModuleFileSystemProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ModuleFileSystemProviderTest.java index 2618c1f805a..a5a8002cd69 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ModuleFileSystemProviderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ModuleFileSystemProviderTest.java @@ -21,6 +21,7 @@ package org.sonar.batch.scan.filesystem; import com.google.common.base.Charsets; import org.apache.commons.io.FileUtils; +import org.apache.commons.io.FilenameUtils; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; @@ -113,11 +114,15 @@ public class ModuleFileSystemProviderTest { assertThat(fs.baseDir().getCanonicalPath()).isEqualTo(baseDir.getCanonicalPath()); assertThat(fs.buildDir().getCanonicalPath()).isEqualTo(buildDir.getCanonicalPath()); assertThat(fs.sourceDirs()).hasSize(1); - assertThat(fs.sourceDirs().get(0).getCanonicalPath()).endsWith("src/main/java"); + assertThat(path(fs.sourceDirs().get(0))).endsWith("src/main/java"); assertThat(fs.testDirs()).hasSize(1); - assertThat(fs.testDirs().get(0).getCanonicalPath()).endsWith("src/test/java"); + assertThat(path(fs.testDirs().get(0))).endsWith("src/test/java"); assertThat(fs.binaryDirs()).hasSize(1); - assertThat(fs.binaryDirs().get(0).getCanonicalPath()).endsWith("target/classes"); + assertThat(path(fs.binaryDirs().get(0))).endsWith("target/classes"); + } + + private String path(File f) throws IOException { + return FilenameUtils.separatorsToUnix(f.getCanonicalPath()); } private ProjectDefinition newSimpleModule() { -- 2.39.5