RedisDistributedLocks { public static DistributedLock getLock(String lockName, long lockExpiredTimeSeconds) { JedisPool jedisPool = getJedisPool(); if (jedisPool == null) { LOGGER.error("Failed to get jedis pool."); return null; } return new RedisDistributedLock(jedisPool, lockName, lockExpiredTimeSeconds); }  static DistributedLock getLock(String lockName, long lockExpiredTimeSeconds);  }
@Test public void testGetLockEmpty() { new Expectations() { { ApplicationContextUtil.getBean(DistributedRedisPoolWrapper.class); result = new NoSuchBeanDefinitionException("DistributedRedisPoolWrapper"); } }; DistributedLock distributedLock = RedisDistributedLocks.getLock("myLock", 30L); assertThat(distributedLock, is(nullValue())); }