From 8c9615849bcc91f26e5c530493ef233c16b0f073 Mon Sep 17 00:00:00 2001 From: "Edwin L. Punzalan" Date: Thu, 8 Jun 2006 13:44:36 +0000 Subject: [PATCH] Improved tests git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@412752 13f79535-47bb-0310-9956-ffa450edef68 --- .../transaction/CreateFileEventTest.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/transaction/CreateFileEventTest.java b/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/transaction/CreateFileEventTest.java index 5a1008e35..2018e89a2 100644 --- a/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/transaction/CreateFileEventTest.java +++ b/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/transaction/CreateFileEventTest.java @@ -54,6 +54,8 @@ public class CreateFileEventTest { File testFile = new File( testDir, "test-file.txt" ); + testFile.getParentFile().mkdirs(); + testFile.createNewFile(); FileUtils.fileWrite( testFile.getAbsolutePath(), "original contents" ); @@ -66,13 +68,15 @@ public class CreateFileEventTest event.commit(); - assertTrue( "Test file is not yet created", testFile.exists() ); + contents = FileUtils.fileRead( testFile.getAbsolutePath() ); + + assertEquals( "Test contents have not changed", "modified contents", contents ); event.rollback(); - assertFalse( "Test file is has been deleted after rollback", testFile.exists() ); - assertFalse( "Test file parent directories has been rolledback too", testDir.exists() ); - assertTrue( "target directory still exists", new File( PlexusTestCase.getBasedir(), "target" ).exists() ); + contents = FileUtils.fileRead( testFile.getAbsolutePath() ); + + assertEquals( "Test contents have not changed", "original contents", contents ); } public void testCreateRollbackCommit() @@ -98,6 +102,7 @@ public class CreateFileEventTest { super.tearDown(); - FileUtils.deleteDirectory( new File( testDir, "target/transaction-tests" ).getAbsolutePath() ); + FileUtils.deleteDirectory( new File( PlexusTestCase.getBasedir(), + "target/transaction-tests" ).getAbsolutePath() ); } } -- 2.39.5