FindClass extends Configured implements Tool { private int usage(String[] args) { err( "Usage : [load | create] <classname>"); err( " [locate | print] <resourcename>]"); err("The return codes are:"); explainResult(SUCCESS, "The operation was successful"); explainResult(E_GENERIC, "Something went wrong"); explainResult(E_USAGE, "This usage message was printed"); explainResult(E_NOT_FOUND, "The class or resource was not found"); explainResult(E_LOAD_FAILED, "The class was found but could not be loaded"); explainResult(E_CREATE_FAILED, "The class was loaded, but an instance of it could not be created"); return E_USAGE; } FindClass();  FindClass(Configuration conf); @VisibleForTesting static void setOutputStreams(PrintStream out, PrintStream err); @Override int run(String[] args); static void main(String[] args); static final String A_CREATE; static final String A_LOAD; static final String A_RESOURCE; static final String A_PRINTRESOURCE; static final int SUCCESS; }
@Test public void testUsage() throws Throwable { run(FindClass.E_USAGE, "org.apache.hadoop.util.TestFindClass"); }