@Test
public void testSplitWithFile() throws Exception {

    final String keyFileName = "exportkeys_test.keys";
    List<HRegionInfo> regionInfoList;
    try {
        {
            // export
            splitTable("a".getBytes());
            splitTable("b".getBytes());
            waitForSplitting(3);
            String[] argsParam = {"zookeeper", tableName, keyFileName, "--force-proceed"};
            Args args = new ManagerArgs(argsParam);
            assertEquals("zookeeper", args.getZookeeperQuorum());
            ExportKeys command = new ExportKeys(admin, args);
            command.run();
            // merge all regions into one
            regionInfoList = getRegionInfoList(tableName);
            mergeRegion(regionInfoList.get(0), regionInfoList.get(1));
            regionInfoList = getRegionInfoList(tableName);
            mergeRegion(regionInfoList.get(0), regionInfoList.get(1));
            assertEquals(1, getRegionInfoList(tableName).size());
        }
        String[] argsParam = {"zookeeper", tableName, "filE", keyFileName, "--force-proceed"};
        Args args = new ManagerArgs(argsParam);
        assertEquals("zookeeper", args.getZookeeperQuorum());
        Split command = new Split(admin, args);
        command.run();
        waitForSplitting(3);
        regionInfoList = getRegionInfoList(tableName);
        assertEquals(3, regionInfoList.size());
    } finally {
        Files.delete(Paths.get(keyFileName));
    }
}