List of usage examples for org.springframework.data.redis RedisSystemException getCause
public synchronized Throwable getCause()
From source file:org.springframework.data.redis.connection.lettuce.LettuceConnectionFactoryTests.java
@Test // DATAREDIS-762, DATAREDIS-869 public void factoryUsesElastiCacheMasterWithoutMaster() { assumeThat(/* w w w .ja v a 2s . c om*/ String.format("No replicas connected to %s:%s.", SettingsUtils.getHost(), SettingsUtils.getPort()), connection.info("replication").getProperty("connected_slaves", "0").compareTo("0") > 0, is(true)); LettuceClientConfiguration configuration = LettuceTestClientConfiguration.builder() .readFrom(ReadFrom.MASTER).build(); RedisStaticMasterReplicaConfiguration elastiCache = new RedisStaticMasterReplicaConfiguration( SettingsUtils.getHost(), SettingsUtils.getPort() + 1); LettuceConnectionFactory factory = new LettuceConnectionFactory(elastiCache, configuration); factory.afterPropertiesSet(); RedisConnection connection = factory.getConnection(); try { connection.ping(); fail("Expected RedisException: Master is currently unknown"); } catch (RedisSystemException e) { assertThat(e.getCause(), is(instanceOf(RedisException.class))); assertThat(e.getCause().getMessage(), containsString("Master is currently unknown")); } finally { connection.close(); } factory.destroy(); }