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