I'm attaching patch version 4.
It's a little bit weird to unwrap RpcNoSuchMethodException in DFSClient.
Thanks for bringing this up. I meant to discuss it earlier. I agree that it's inconsistent to unwrap this in the client. Patch v4 goes back to unwrapping inside ls.
The unit test can be greatly simplified using mockito, but it can be addressed in a separate jira.
The trouble here is that Mockito decorates instances, not classes. For the shell, the FileSystem cache takes responsbility for creating the instance internally via reflection. We don't have direct control of the instance it gets, only the class definition specified via configuration. To test that the shell executes successfully (exit code 0), it seems this is what we have to do. I don't see a way to use Mockito, but if you have an idea, let me know.