@Override
  public boolean shouldCopy(Path path) {
    for (Pattern filter : filters) {
      if (filter.matcher(path.toString()).matches()) {
        LOG.debug("Skipping {} as it matches the filter regex",
                path.toString());
        return false;
      }
    }
    return true;
  }
@Test
  public void testShouldCopy() {
    Configuration configuration = new Configuration(false);
    configuration.set(DistCpConstants.DISTCP_EXCLUDE_FILE_REGEX,
            "\\/.*_COPYING_$|\\/.*_COPYING$|^.*\\/\\.[^\\/]*$|" +
                    "\\/_temporary$|\\/\\_temporary\\/|.*\\/\\.Trash\\/.*");
    RegexpInConfigurationFilter defaultCopyFilter =
            new RegexpInConfigurationFilter(configuration);
    Path shouldCopyPath = new Path("/user/bar");
    assertTrue(shouldCopyPath.toString() + " should be copied",
            defaultCopyFilter.shouldCopy(shouldCopyPath));
    shouldCopyPath = new Path("/user/bar/_COPYING");
    assertFalse(shouldCopyPath.toString() + " shouldn't be copied",
            defaultCopyFilter.shouldCopy(shouldCopyPath));
    shouldCopyPath = new Path("/user/bar/_COPYING_");
    assertFalse(shouldCopyPath.toString() + " shouldn't be copied",
            defaultCopyFilter.shouldCopy(shouldCopyPath));
    shouldCopyPath = new Path("/temp/");
    assertTrue(shouldCopyPath.toString() + " should be copied",
            defaultCopyFilter.shouldCopy(shouldCopyPath));
  }