@Before public void before() throws Throwable {
    tableWorkingPath = temporaryFolder.newFolder().getAbsolutePath();
    segmentsTable = derbyConnectorRule.metadataTablesConfigSupplier().get().getSegmentsTable();
    Map<String, String> params = new HashMap<>();
    params.put("external.table.purge", "TRUE");
    Mockito.when(tableMock.getParameters()).thenReturn(params);
    Mockito.when(tableMock.getPartitionKeysSize()).thenReturn(0);
    StorageDescriptor storageDes = Mockito.mock(StorageDescriptor.class);
    Mockito.when(storageDes.getBucketColsSize()).thenReturn(0);
    Mockito.when(tableMock.getSd()).thenReturn(storageDes);
    Mockito.when(tableMock.getDbName()).thenReturn(DB_NAME);
    Mockito.when(tableMock.getTableName()).thenReturn(TABLE_NAME);
    config = new Configuration();
    config.set(String.valueOf(HiveConf.ConfVars.HIVE_QUERY_ID), "hive-" + UUID.randomUUID().toString());
    config.set(String.valueOf(HiveConf.ConfVars.DRUID_WORKING_DIR), tableWorkingPath);
    config.set(String.valueOf(HiveConf.ConfVars.DRUID_SEGMENT_DIRECTORY),
        new Path(tableWorkingPath, "finalSegmentDir").toString());
    config.set("hive.druid.maxTries", "0");
    druidStorageHandler =
        new DruidStorageHandler(derbyConnectorRule.getConnector(),
            derbyConnectorRule.metadataTablesConfigSupplier().get());
    druidStorageHandler.setConf(config);
  }
Test class for Druid Storage handler.
druid-handler/src/test/org/apache/hadoop/hive/druid/TestDruidStorageHandler.java