HBaseConfig { @Bean() public HBaseClient hBaseClient() { Map<String, Object> restConfig = null; try { restConfig = globalConfigService.get(); } catch (RestException e) { throw new IllegalStateException("Unable to retrieve the global config.", e); } TableProvider provider = null; try { provider = TableProvider .create((String) restConfig.get(EnrichmentConfigurations.TABLE_PROVIDER), HTableProvider::new); } catch (ClassNotFoundException | InstantiationException | InvocationTargetException | IllegalAccessException | NoSuchMethodException e) { throw new IllegalStateException("Unable to create table provider", e); } return new HBaseClient(provider, HBaseConfiguration.create(), (String) restConfig.get(EnrichmentConfigurations.TABLE_NAME)); } @Autowired  HBaseConfig(GlobalConfigService globalConfigService); @Bean() UserSettingsClient userSettingsClient(); @Bean() HBaseClient hBaseClient();  }
@Test public void hBaseClientShouldBeCreatedWithSpecifiedProvider() throws Exception { when(globalConfigService.get()).thenReturn(new HashMap<String, Object>() {{ put(EnrichmentConfigurations.TABLE_PROVIDER, MockHBaseTableProvider.class.getName()); put(EnrichmentConfigurations.TABLE_NAME, "enrichment_list_hbase_table_name"); }}); assertNotNull(hBaseConfig.hBaseClient()); }