MockTabletLocator locator = new MockTabletLocator();
FileSystem fs = FileSystem.getLocal(CachedConfiguration.getInstance());
AccumuloConfiguration acuConf = AccumuloConfiguration.getDefaultConfiguration();
String file = "target/testFile.rf";
fs.delete(new Path(file), true);
FileSKVWriter writer = FileOperations.getInstance().openWriter(file, fs, fs.getConf(), acuConf);
writer.startDefaultLocalityGroup();
Value empty = new Value(new byte[] {});
writer.append(new Key("a", "cf", "cq"), empty);
writer.append(new Key("a", "cf", "cq1"), empty);
writer.append(new Key("a", "cf", "cq2"), empty);
writer.append(new Key("a", "cf", "cq3"), empty);
writer.append(new Key("a", "cf", "cq4"), empty);
writer.append(new Key("a", "cf", "cq5"), empty);
writer.append(new Key("d", "cf", "cq"), empty);
writer.append(new Key("d", "cf", "cq1"), empty);
writer.append(new Key("d", "cf", "cq2"), empty);
writer.append(new Key("d", "cf", "cq3"), empty);
writer.append(new Key("d", "cf", "cq4"), empty);
writer.append(new Key("d", "cf", "cq5"), empty);
writer.append(new Key("dd", "cf", "cq1"), empty);
writer.append(new Key("ichabod", "cf", "cq"), empty);
writer.append(new Key("icky", "cf", "cq1"), empty);
writer.append(new Key("iffy", "cf", "cq2"), empty);
writer.append(new Key("internal", "cf", "cq3"), empty);
writer.append(new Key("is", "cf", "cq4"), empty);
writer.append(new Key("iterator", "cf", "cq5"), empty);
writer.append(new Key("xyzzy", "cf", "cq"), empty);
writer.close();
List<TabletLocation> overlaps = BulkImporter.findOverlappingTablets(acuConf, fs, locator, new Path(file), credentials);
Assert.assertEquals(5, overlaps.size());
Collections.sort(overlaps);
Assert.assertEquals(new KeyExtent(tableId, new Text("a"), null), overlaps.get(0).tablet_extent);
Assert.assertEquals(new KeyExtent(tableId, new Text("d"), new Text("cm")), overlaps.get(1).tablet_extent);