### Question:
CassandraConfigurationFileImpl implements CassandraConfiguration { @Override public String password() { return getMandatoryStringValue(CASSANDRA_PASSWORD); } @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 testPasswordNotDefined() { try { expect(iniFile.getStringValue(CassandraConfigurationFileImpl.CASSANDRA_PASSWORD)) .andReturn(null); control.replay(); CassandraConfigurationFileImpl cassandraConfigurationFileImpl = new CassandraConfigurationFileImpl(iniFile); cassandraConfigurationFileImpl.password(); } catch (NullPointerException e) { control.verify(); throw e; } }
@Test public void testPassword() { String expectedPassword = "password"; expect(iniFile.getStringValue(CassandraConfigurationFileImpl.CASSANDRA_PASSWORD)) .andReturn(expectedPassword); control.replay(); CassandraConfigurationFileImpl cassandraConfigurationFileImpl = new CassandraConfigurationFileImpl(iniFile); String password = cassandraConfigurationFileImpl.password(); control.verify(); assertThat(password).isEqualTo(expectedPassword); }