@Override
  protected void processOptions(LinkedList<String> args)
  throws IOException {
    CommandFormat cf = new CommandFormat(0, Integer.MAX_VALUE,
        OPTION_PATHONLY, OPTION_DIRECTORY, OPTION_HUMAN,
        OPTION_HIDENONPRINTABLE, OPTION_RECURSIVE, OPTION_REVERSE,
        OPTION_MTIME, OPTION_SIZE, OPTION_ATIME, OPTION_ECPOLICY);
    cf.parse(args);
    pathOnly = cf.getOpt(OPTION_PATHONLY);
    dirRecurse = !cf.getOpt(OPTION_DIRECTORY);
    setRecursive(cf.getOpt(OPTION_RECURSIVE) && dirRecurse);
    humanReadable = cf.getOpt(OPTION_HUMAN);
    hideNonPrintable = cf.getOpt(OPTION_HIDENONPRINTABLE);
    orderReverse = cf.getOpt(OPTION_REVERSE);
    orderTime = cf.getOpt(OPTION_MTIME);
    orderSize = !orderTime && cf.getOpt(OPTION_SIZE);
    useAtime = cf.getOpt(OPTION_ATIME);
    displayECPolicy = cf.getOpt(OPTION_ECPOLICY);
    if (args.isEmpty()) args.add(Path.CUR_DIR);

    initialiseOrderComparator();
  }
@Test
  public void processPathDirsOrderMtime() throws IOException {
    TestFile testfile01 = new TestFile("testDirectory01", "testFile01");
    TestFile testfile02 = new TestFile("testDirectory01", "testFile02");
    TestFile testfile03 = new TestFile("testDirectory01", "testFile03");
    TestFile testfile04 = new TestFile("testDirectory02", "testFile04");
    TestFile testfile05 = new TestFile("testDirectory02", "testFile05");
    TestFile testfile06 = new TestFile("testDirectory02", "testFile06");

    // set file mtime in different order to file names
    testfile01.setMtime(NOW.getTime() + 10);
    testfile02.setMtime(NOW.getTime() + 30);
    testfile03.setMtime(NOW.getTime() + 20);
    testfile04.setMtime(NOW.getTime() + 60);
    testfile05.setMtime(NOW.getTime() + 40);
    testfile06.setMtime(NOW.getTime() + 50);

    TestFile testDir01 = new TestFile("", "testDirectory01");
    testDir01.setIsDir(true);
    testDir01.addContents(testfile01, testfile02, testfile03);

    TestFile testDir02 = new TestFile("", "testDirectory02");
    testDir02.setIsDir(true);
    testDir02.addContents(testfile04, testfile05, testfile06);

    LinkedList<PathData> pathData = new LinkedList<PathData>();
    pathData.add(testDir01.getPathData());
    pathData.add(testDir02.getPathData());

    PrintStream out = mock(PrintStream.class);

    Ls ls = new Ls();
    ls.out = out;

    LinkedList<String> options = new LinkedList<String>();
    options.add("-t");
    ls.processOptions(options);
    String lineFormat = TestFile.computeLineFormat(pathData);

    ls.processArguments(pathData);
    InOrder inOrder = inOrder(out);
    inOrder.verify(out).println("Found 3 items");
    inOrder.verify(out).println(testfile02.formatLineMtime(lineFormat));
    inOrder.verify(out).println(testfile03.formatLineMtime(lineFormat));
    inOrder.verify(out).println(testfile01.formatLineMtime(lineFormat));
    inOrder.verify(out).println("Found 3 items");
    inOrder.verify(out).println(testfile04.formatLineMtime(lineFormat));
    inOrder.verify(out).println(testfile06.formatLineMtime(lineFormat));
    inOrder.verify(out).println(testfile05.formatLineMtime(lineFormat));
    verifyNoMoreInteractions(out);
  }