logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1583374 - /logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/junit/CleanFiles.java
Date Mon, 31 Mar 2014 16:49:53 GMT
Author: ggregory
Date: Mon Mar 31 16:49:52 2014
New Revision: 1583374

URL: http://svn.apache.org/r1583374
Log:
Show why the test clean up is failing in the JUnit assert message.

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/junit/CleanFiles.java

Modified: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/junit/CleanFiles.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/junit/CleanFiles.java?rev=1583374&r1=1583373&r2=1583374&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/junit/CleanFiles.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/junit/CleanFiles.java
Mon Mar 31 16:49:52 2014
@@ -16,14 +16,16 @@
  */
 package org.apache.logging.log4j.junit;
 
-import org.junit.rules.ExternalResource;
+import static org.junit.Assert.assertTrue;
 
 import java.io.File;
+import java.sql.Date;
+import java.text.DateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.junit.Assert.assertTrue;
+import org.junit.rules.ExternalResource;
 
 /**
  * A JUnit test rule to automatically delete certain files after a test is run.
@@ -45,8 +47,10 @@ public class CleanFiles extends External
     private void clean() {
         for (final File file : files) {
             if (file.exists()) {
-                assertTrue(file.toString(), file.delete());
-            }
+                assertTrue(
+                        "Could not delete " + file.toString() + ", last modifed "
+                                + DateFormat.getInstance().format(new Date(file.lastModified())),
file.delete());
+            } 
         }
     }
 



Mime
View raw message