Browse Source

commit ef621a7765324c40c04d996a8779064c4395278c
Author: Hairong Kuang <hairong@ucdev21.inktomisearch.com>
Date: Mon Mar 1 19:18:36 2010 +0000

HDFS:985 from http://issues.apache.org/jira/secure/attachment/12437499/testFileStatus.patch


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-patches@1077258 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 14 years ago
parent
commit
7225300320
1 changed files with 8 additions and 2 deletions
  1. 8 2
      src/test/org/apache/hadoop/hdfs/TestFileStatus.java

+ 8 - 2
src/test/org/apache/hadoop/hdfs/TestFileStatus.java

@@ -18,6 +18,8 @@
 package org.apache.hadoop.hdfs;
 package org.apache.hadoop.hdfs;
 
 
 import junit.framework.TestCase;
 import junit.framework.TestCase;
+
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.IOException;
 import java.util.Random;
 import java.util.Random;
 
 
@@ -126,8 +128,12 @@ public class TestFileStatus extends TestCase {
       // test listStatus on a non-existent file/directory
       // test listStatus on a non-existent file/directory
       stats = fs.listStatus(dir);
       stats = fs.listStatus(dir);
       assertEquals(null, stats);
       assertEquals(null, stats);
-      status = fs.getFileStatus(dir);
-      assertEquals(null, status);
+      try {
+        status = fs.getFileStatus(dir);
+        fail("getFileStatus of non-existent path should fail");
+      } catch (FileNotFoundException fe) {
+        assertTrue(fe.getMessage().startsWith("File does not exist"));
+      }
       
       
       // create the directory
       // create the directory
       assertTrue(fs.mkdirs(dir));
       assertTrue(fs.mkdirs(dir));