RedisQueuesShardingStrategyProvider implements Provider<ShardingStrategy> { @Override public ShardingStrategy get() { String shardingStrat = configuration.getProperty(STRATEGY_TYPE_PROPERTY, ROUND_ROBIN_STRATEGY); if (shardingStrat.equals(LOCAL_ONLY_STRATEGY)) { logger.info("Using {} sharding strategy for queues", LocalOnlyStrategy.class.getSimpleName()); return new LocalOnlyStrategy(shardSupplier); } else { logger.info("Using {} sharding strategy for queues", RoundRobinStrategy.class.getSimpleName()); return new RoundRobinStrategy(); } } @Inject  RedisQueuesShardingStrategyProvider(
            ShardSupplier ss,
            DynomiteConfiguration config
    ); @Override ShardingStrategy get(); static final String STRATEGY_TYPE_PROPERTY; static final String ROUND_ROBIN_STRATEGY; static final String LOCAL_ONLY_STRATEGY; }
@Test public void testProvider() { ShardSupplier ss = Mockito.mock(ShardSupplier.class); DynomiteConfiguration dc = Mockito.mock(DynomiteConfiguration.class); Mockito.doReturn("localOnly").when(dc) .getProperty(ArgumentMatchers.anyString(), ArgumentMatchers.anyString()); RedisQueuesShardingStrategyProvider stratProvider = new RedisQueuesShardingStrategyProvider(ss, dc); Assert.assertTrue(stratProvider.get() instanceof RedisQueuesShardingStrategyProvider.LocalOnlyStrategy); }