@VisibleForTesting
  public Map<String, HashSet<String>> runTest(Set<String> inputList, Map<String, Long> sizes)  {
    try {
      conf = msConf;
      testDatasizes = sizes;
      coverageList.clear();
      removeNestedStructure(inputList);
      createOutputList(inputList, "test", "test");
    } catch (Exception e) {
      LOG.error("MetaToolTask failed on ListExtTblLocs test: ", e);
    }
    return coverageList;
  }
@Test
  public void testGroupLocationsDummyDataSizes() {
    Set<String> inputLocations = new TreeSet<>();
    Configuration conf = MetastoreConf.newMetastoreConf();
    MetastoreConf.setBoolVar(conf, MetastoreConf.ConfVars.HIVE_IN_TEST, true);
    MetaToolTaskListExtTblLocs.msConf = conf;
    MetaToolTaskListExtTblLocs task = new MetaToolTaskListExtTblLocs();

    //Case 1: Multiple unpartitioned external tables, expected o/p without extra data: 1 location (tested in testGroupLocations#1)
    //        But say there is some data at ../customLocation, then we list all the 3 paths
    inputLocations.add("/warehouse/customLocation/t1");
    inputLocations.add("/warehouse/customLocation/t2");
    inputLocations.add("/warehouse/customLocation/t3");
    Map<String, Long> dataSizes = new HashMap<>();
    dataSizes.put("/warehouse/customLocation", Long.valueOf(100)); //Simulate 100 bytes extra data at customLocation
    Map<String, HashSet<String>> output = task.runTest(inputLocations, dataSizes);
    Assert.assertEquals(3, output.size());
    String expectedOutput1 = "/warehouse/customLocation/t1";
    Assert.assertTrue(output.containsKey(expectedOutput1));
    HashSet<String> coveredLocs = output.get(expectedOutput1);
    Assert.assertEquals(1, coveredLocs.size());
    Assert.assertTrue(coveredLocs.contains("/warehouse/customLocation/t1"));

    //Case 2 : inputs at multiple depths
    // inputs   ../ext/b0 - contains 1 location
    //          ../ext/p=0 - contains 1 location
    //          ../ext/b1/b2/b3 - contains 3 locations (p1, p2, p3)
    // expected output without extra data  : [../ext/b1/b2/b3 containing 3 elements, t1, p0]  (tested in testGroupLocations#2)
    // expected output with extra data at ../ext/b1/b2/b3 : [p1, p2, p3, t1, p0]
    inputLocations.clear();
    dataSizes.clear();
    inputLocations.add("/warehouse/customLocation/ext/b0");
    inputLocations.add("/warehouse/customLocation/ext/p=0");
    inputLocations.add("/warehouse/customLocation/ext/b1/b2/b3/p=1");
    inputLocations.add("/warehouse/customLocation/ext/b1/b2/b3/p=2");
    inputLocations.add("/warehouse/customLocation/ext/b1/b2/b3/p=3");
    dataSizes.put("/warehouse/customLocation/ext/b1/b2/b3", Long.valueOf(100));  // simulate 100 bytes of extra data at ../b3
    output = task.runTest(inputLocations, dataSizes);
    Assert.assertEquals(5, output.size());
    expectedOutput1 = "/warehouse/customLocation/ext/b0";
    Assert.assertTrue(output.containsKey(expectedOutput1));
    coveredLocs = output.get(expectedOutput1);
    Assert.assertEquals(1, coveredLocs.size());
    Assert.assertTrue(coveredLocs.contains("/warehouse/customLocation/ext/b0"));
    String expectedOutput2 = "/warehouse/customLocation/ext/p=0";
    Assert.assertTrue(output.containsKey(expectedOutput2));
    coveredLocs = output.get(expectedOutput2);
    Assert.assertEquals(1, coveredLocs.size());
    Assert.assertTrue(coveredLocs.contains("/warehouse/customLocation/ext/p=0"));
    String expectedOutput3 = "/warehouse/customLocation/ext/b1/b2/b3/p=1";
    Assert.assertTrue(output.containsKey(expectedOutput3));
    coveredLocs = output.get(expectedOutput3);
    Assert.assertEquals(1, coveredLocs.size());
    Assert.assertTrue(coveredLocs.contains("/warehouse/customLocation/ext/b1/b2/b3/p=1"));
    String expectedOutput4 = "/warehouse/customLocation/ext/b1/b2/b3/p=2";
    Assert.assertTrue(output.containsKey(expectedOutput4));
    coveredLocs = output.get(expectedOutput4);
    Assert.assertEquals(1, coveredLocs.size());
    Assert.assertTrue(coveredLocs.contains("/warehouse/customLocation/ext/b1/b2/b3/p=2"));
    String expectedOutput5 = "/warehouse/customLocation/ext/b1/b2/b3/p=3";
    Assert.assertTrue(output.containsKey(expectedOutput5));
    coveredLocs = output.get(expectedOutput5);
    Assert.assertEquals(1, coveredLocs.size());
    Assert.assertTrue(coveredLocs.contains("/warehouse/customLocation/ext/b1/b2/b3/p=3"));

    //Case 3 : intermediate directory has extra data
    // inputs   ../ext/ - contains 4 locations
    //          ../ext/b1 - contains 3 locations
    // expected output without extra data : [../ext covering all locations] (tested in testGroupLocations#3)
    // We simulate extra data at ../ext/b1. So, expected output is the list of all locations.
    inputLocations.clear();
    dataSizes.clear();
    inputLocations.add("/warehouse/customLocation/ext/p=0");
    inputLocations.add("/warehouse/customLocation/ext/p=1");
    inputLocations.add("/warehouse/customLocation/ext/p=2");
    inputLocations.add("/warehouse/customLocation/ext/p=3");
    inputLocations.add("/warehouse/customLocation/ext/b1/p=4");
    inputLocations.add("/warehouse/customLocation/ext/b1/p=5");
    inputLocations.add("/warehouse/customLocation/ext/b1/p=6");
    dataSizes.put("/warehouse/customLocation/ext/b1", Long.valueOf(100));  // simulate 100 bytes of extra data at ..ext/b1
    dataSizes.put("/warehouse/customLocation/ext", Long.valueOf(100));// since ext/b1 contains 100 bytes, ../ext also has 100 bytes
    output = task.runTest(inputLocations, dataSizes);
    Assert.assertEquals(7, output.size());
    Assert.assertTrue(output.keySet().containsAll(inputLocations));
    for(String outLoc : output.keySet()) {
      Assert.assertTrue(output.get(outLoc).contains(outLoc));
    }
  }