### Question:
CassandraConfigurationFileImpl implements CassandraConfiguration { @Override public Collection<String> seeds() { String allSeeds = getMandatoryStringValue(CASSANDRA_SEEDS); return Splitter.on(CASSANDRA_SEEDS_SEPARATOR) .omitEmptyStrings() .trimResults() .splitToList(allSeeds); } @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(expected=NullPointerException.class) public void testSeedsNotDefined() { try { expect(iniFile.getStringValue(CassandraConfigurationFileImpl.CASSANDRA_SEEDS)) .andReturn(null); control.replay(); CassandraConfigurationFileImpl cassandraConfigurationFileImpl = new CassandraConfigurationFileImpl(iniFile); cassandraConfigurationFileImpl.seeds(); } catch (NullPointerException e) { control.verify(); throw e; } }
@Test public void testOneSeed() { String expectedSeed = "localhost"; expect(iniFile.getStringValue(CassandraConfigurationFileImpl.CASSANDRA_SEEDS)) .andReturn(expectedSeed); control.replay(); CassandraConfigurationFileImpl cassandraConfigurationFileImpl = new CassandraConfigurationFileImpl(iniFile); Collection<String> seed = cassandraConfigurationFileImpl.seeds(); control.verify(); assertThat(seed).containsOnly(expectedSeed); }
@Test public void testThreeSeeds() { String expectedSeeds = "localhost,192.0.0.1,0.0.0.0"; expect(iniFile.getStringValue(CassandraConfigurationFileImpl.CASSANDRA_SEEDS)) .andReturn(expectedSeeds); control.replay(); CassandraConfigurationFileImpl cassandraConfigurationFileImpl = new CassandraConfigurationFileImpl(iniFile); Collection<String> seed = cassandraConfigurationFileImpl.seeds(); control.verify(); assertThat(seed).containsOnly("localhost", "192.0.0.1", "0.0.0.0"); }
@Test public void testThreeSeedsWithSpace() { String expectedSeeds = " localhost, 192.0.0.1 , 0.0.0.0 "; expect(iniFile.getStringValue(CassandraConfigurationFileImpl.CASSANDRA_SEEDS)) .andReturn(expectedSeeds); control.replay(); CassandraConfigurationFileImpl cassandraConfigurationFileImpl = new CassandraConfigurationFileImpl(iniFile); Collection<String> seed = cassandraConfigurationFileImpl.seeds(); control.verify(); assertThat(seed).containsOnly("localhost", "192.0.0.1", "0.0.0.0"); }
@Test public void testThreeSeedsWithUnexpectedComma() { String expectedSeeds = " localhost,, 192.0.0.1, , 0.0.0.0 "; expect(iniFile.getStringValue(CassandraConfigurationFileImpl.CASSANDRA_SEEDS)) .andReturn(expectedSeeds); control.replay(); CassandraConfigurationFileImpl cassandraConfigurationFileImpl = new CassandraConfigurationFileImpl(iniFile); Collection<String> seed = cassandraConfigurationFileImpl.seeds(); control.verify(); assertThat(seed).containsOnly("localhost", "192.0.0.1", "0.0.0.0"); }