]> source.dussan.org Git - sonarqube.git/commitdiff
Fix unit test on windows
authorSimon Brandhof <simon.brandhof@gmail.com>
Fri, 31 May 2013 11:57:37 +0000 (13:57 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Fri, 31 May 2013 11:57:37 +0000 (13:57 +0200)
sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java

index f5cf58d7e5b8094ab635fd308c968122f574d252..fda04beb553f87be48c42a290d61bb8c9f35bcd7 100644 (file)
@@ -62,7 +62,7 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase {
   public void should_create_database_without_project() throws IOException, SQLException {
     setupData("should_create_database");
 
-    when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.getRoot());
+    when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.newFolder());
 
     byte[] database = localDatabaseFactory.createDatabaseForDryRun(null);
     dataSource = createDatabase(database);
@@ -75,7 +75,7 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase {
   public void should_create_database_with_project() throws IOException, SQLException {
     setupData("should_create_database");
 
-    when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.getRoot());
+    when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.newFolder());
 
     byte[] database = localDatabaseFactory.createDatabaseForDryRun(123L);
     dataSource = createDatabase(database);
@@ -88,7 +88,7 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase {
   public void should_create_database_with_issues() throws IOException, SQLException {
     setupData("should_create_database_with_issues");
 
-    when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.getRoot());
+    when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.newFolder());
 
     byte[] database = localDatabaseFactory.createDatabaseForDryRun(399L);
     dataSource = createDatabase(database);
@@ -100,7 +100,7 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase {
   public void should_export_issues_of_project_tree() throws IOException, SQLException {
     setupData("multi-modules-with-issues");
 
-    when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.getRoot());
+    when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.newFolder());
 
     // 300 : root module -> export issues of all modules
     byte[] database = localDatabaseFactory.createDatabaseForDryRun(300L);
@@ -112,7 +112,7 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase {
   public void should_export_issues_of_sub_module() throws IOException, SQLException {
     setupData("multi-modules-with-issues");
 
-    when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.getRoot());
+    when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.newFolder());
 
     // 301 : sub module with 1 closed issue and 1 open issue
     byte[] database = localDatabaseFactory.createDatabaseForDryRun(301L);
@@ -124,13 +124,13 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase {
   public void should_export_issues_of_sub_module_2() throws IOException, SQLException {
     setupData("multi-modules-with-issues");
 
-    when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.getRoot());
+    when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.newFolder());
 
     // 302 : sub module without any issues
     byte[] database = localDatabaseFactory.createDatabaseForDryRun(302L);
     dataSource = createDatabase(database);
     assertThat(rowCount("issues")).isEqualTo(0);
-    FileUtils.cleanDirectory(temporaryFolder.getRoot());
+    FileUtils.cleanDirectory(temporaryFolder.newFolder());
   }
 
   private BasicDataSource createDatabase(byte[] db) throws IOException {