@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));
}