@Override
    public boolean accept(File dir, String fileName) {
      return pattern.matcher(fileName).matches();
    }
This test ensures that there are no dangling q.out files in the project

It has a cli functionlity to remove them if there are any.
itests/util/src/test/java/org/apache/hadoop/hive/cli/control/TestDanglingQOuts.java