### Question:
CassandraConfigurationFileImpl implements CassandraConfiguration { @Override public CassandraRetryPolicy retryPolicy() { String value = iniFile.getStringValue(CASSANDRA_RETRY_POLICY); return Strings.isNullOrEmpty(value) ? DEFAULT_CASSANDRA_RETRY_POLICY : CassandraRetryPolicy.valueOf(value.toUpperCase()); } @VisibleForTesting  CassandraConfigurationFileImpl(IniFile iniFile); @Override Collection<String> seeds(); @Override String keyspace(); @Override String user(); @Override String password(); @Override int readTimeoutMs(); @Override CassandraRetryPolicy retryPolicy(); @Override int maxRetries();  }### Answer:
@Test public void retryPolicyNotInConfigurationFile() { expect(iniFile.getStringValue(CassandraConfigurationFileImpl.CASSANDRA_RETRY_POLICY)) .andReturn(null); control.replay(); CassandraRetryPolicy retryPolicy = new CassandraConfigurationFileImpl(iniFile).retryPolicy(); control.verify(); assertThat(retryPolicy).isEqualTo(CassandraRetryPolicy.ALWAYS_RETRY); }
@Test public void retryPolicyEmptyInConfigurationFile() { expect(iniFile.getStringValue(CassandraConfigurationFileImpl.CASSANDRA_RETRY_POLICY)) .andReturn(""); control.replay(); CassandraRetryPolicy retryPolicy = new CassandraConfigurationFileImpl(iniFile).retryPolicy(); control.verify(); assertThat(retryPolicy).isEqualTo(CassandraRetryPolicy.ALWAYS_RETRY); }
@Test(expected=IllegalArgumentException.class) public void retryPolicyBadValueInConfigurationFile() { expect(iniFile.getStringValue(CassandraConfigurationFileImpl.CASSANDRA_RETRY_POLICY)) .andReturn("bad"); control.replay(); try { new CassandraConfigurationFileImpl(iniFile).retryPolicy(); } finally { control.verify(); } }
@Test public void retryPolicyRetry() { expect(iniFile.getStringValue(CassandraConfigurationFileImpl.CASSANDRA_RETRY_POLICY)) .andReturn(CassandraRetryPolicy.ALWAYS_RETRY.name()); control.replay(); CassandraRetryPolicy retryPolicy = new CassandraConfigurationFileImpl(iniFile).retryPolicy(); control.verify(); assertThat(retryPolicy).isEqualTo(CassandraRetryPolicy.ALWAYS_RETRY); }
@Test public void retryPolicyDowngrade() { expect(iniFile.getStringValue(CassandraConfigurationFileImpl.CASSANDRA_RETRY_POLICY)) .andReturn(CassandraRetryPolicy.RETRY_OR_CL_DOWNGRADE.name()); control.replay(); CassandraRetryPolicy retryPolicy = new CassandraConfigurationFileImpl(iniFile).retryPolicy(); control.verify(); assertThat(retryPolicy).isEqualTo(CassandraRetryPolicy.RETRY_OR_CL_DOWNGRADE); }