    @Test
    public void testValidateBag() { 

        final String TEST_FILE1 = "item.pdf";
        final String TEST_FILE2 = "banjo.jpg";
        final String TEST_FILE_WITH_SPACE = "peacock butterfly.jpeg";
        final String EMPTY_DIR_NAME = "emptydir";
        final String CHILD_DIR_NAME = "childdir";
        final String CHILD_DIR_WITH_SPACE = "second childdir";
        final String TEST_FILE_WITH_US = "ko_ala.jpg";
        final String TEST_FILE_WITH_HY = "peng-uins.jpg";
        
        File parentDir =  new File(testDir, "validatebag");
        parentDir.mkdir();
        File emptyDir =  new File(parentDir, EMPTY_DIR_NAME);
        emptyDir.mkdir();
        File childDir =  new File(parentDir, CHILD_DIR_NAME);
        File test1file = null;
        File test2file = null;
        File test3file = null;
        File secondChildDir =  new File(parentDir, CHILD_DIR_WITH_SPACE);
        secondChildDir.mkdir();
        File test4file = null;
        File test5file = null;
        
        try{
            test1file = new File(packagerResources, TEST_FILE1);
            FileUtils.copyFileToDirectory(
                    new File(packagerResources, TEST_FILE1),
                    parentDir);
            test2file = new File(packagerResources, TEST_FILE2);
            FileUtils.copyFileToDirectory(test2file, childDir);
            test3file = new File(packagerResources, TEST_FILE_WITH_SPACE);
            FileUtils.copyFileToDirectory(test3file, parentDir);
            test4file = new File(packagerResources, TEST_FILE_WITH_US);
            FileUtils.copyFileToDirectory(test4file, secondChildDir);
            test5file = new File(packagerResources, TEST_FILE_WITH_HY);
            FileUtils.copyFileToDirectory(test5file, secondChildDir);
            
            // create symlink in parent file to file in child
            Path source = Paths.get(childDir.getAbsolutePath() + File.separator + TEST_FILE2);
            Path link = Paths.get(parentDir.getAbsolutePath() + File.separator + TEST_FILE2);
            Path relativeSrc = link.getParent().relativize(source); 
            Files.createSymbolicLink(link, relativeSrc);
        }
        catch(IOException ex){
            ex.printStackTrace();
            fail(ex.getMessage());
        }
        
        try{
            Packager.createBag(parentDir);
            assertTrue(Packager.validateBag(parentDir));

            // #1 check files in manifest 
            List<String> lines = FileUtils.readLines(
                    new File(parentDir.getAbsolutePath() + File.separator + "manifest-md5.txt"));
            assertTrue(lines.contains(this.getChecksum(test1file) + "  data" +
                    File.separator + TEST_FILE1));
            assertTrue(lines.contains(this.getChecksum(test2file) + "  data" +
                    File.separator + CHILD_DIR_NAME + File.separator + TEST_FILE2));
            assertTrue(lines.contains(this.getChecksum(test3file) + "  data" +
                    File.separator + TEST_FILE_WITH_SPACE));
           
            // #2 check symlinks
            File dataDir = new File(parentDir + File.separator + "data");
            File simLink = new File(dataDir, TEST_FILE2);
            assertTrue(simLink.exists() && FileUtils.isSymlink(simLink));
            
            // #3 check empty dir exists
            assertTrue(new File(dataDir, EMPTY_DIR_NAME).isDirectory());
            
            // # 4 check files exist
            assertTrue(new File(dataDir, TEST_FILE1).exists());
            assertTrue(new File(dataDir + File.separator + CHILD_DIR_NAME,
                    TEST_FILE2).exists());
            assertTrue(new File(dataDir, TEST_FILE_WITH_SPACE).exists());
            File childDirWithSpace = new File(parentDir + File.separator +
                    "data" + File.separator + CHILD_DIR_WITH_SPACE);
            assertTrue(new File(childDirWithSpace, TEST_FILE_WITH_US).exists());
            assertTrue(new File(childDirWithSpace, TEST_FILE_WITH_HY).exists());
        }        
        catch(Exception ex){
            ex.printStackTrace();
            fail(ex.getMessage());
        }
    }