Revision: 9916
Author:   [email protected]
Date:     Wed Mar 30 06:55:27 2011
Log: Fixes build break - unit test expected non-existent dir to throw an exception

Review at http://gwt-code-reviews.appspot.com/1396802

Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=9916

Modified:
 /trunk/dev/core/test/com/google/gwt/dev/javac/PersistentUnitCacheTest.java

=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/javac/PersistentUnitCacheTest.java Mon Mar 28 11:28:56 2011 +++ /trunk/dev/core/test/com/google/gwt/dev/javac/PersistentUnitCacheTest.java Wed Mar 30 06:55:27 2011
@@ -38,14 +38,18 @@
     lastCacheDir = null;
   }

-  public void testBadDir() {
+  /**
+   * The cache should recursively create the directories it needs.
+   */
+  public void testNewDir() throws IOException, UnableToCompleteException {
     TreeLogger logger = TreeLogger.NULL;
-    File badDir = new File("sHoUlDnOtExi57");
-    try {
-      new PersistentUnitCache(logger, badDir);
-      fail("Expected an exception to be thrown");
-    } catch (UnableToCompleteException expected) {
-    }
+    File baseDir = File.createTempFile("PersistentUnitTest-newDir", "");
+    assertNotNull(baseDir);
+    assertTrue(baseDir.exists());
+    assertTrue(baseDir.delete());
+    File newDir = lastCacheDir = new File(baseDir, "sHoUlDnOtExi57");
+    new PersistentUnitCache(logger, newDir);
+    assertTrue(newDir.isDirectory());
   }

   /**
@@ -55,6 +59,8 @@
   public void testFileInTheWay() throws IOException {
     TreeLogger logger = TreeLogger.NULL;
File fileInTheWay = File.createTempFile("PersistentUnitTest-inTheWay", "");
+    assertNotNull(fileInTheWay);
+    assertTrue(fileInTheWay.exists());
     fileInTheWay.deleteOnExit();
     try {
       new PersistentUnitCache(logger, fileInTheWay);

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to