Keyspace { public String getCqlStatement() { StringBuilder builder = new StringBuilder(60); builder.append("CREATE KEYSPACE IF NOT EXISTS ") .append(getKeyspaceName()) .append(" WITH REPLICATION = ") .append(getReplicationStrategy().createCqlStatement()) .append(" AND DURABLE_WRITES = ") .append(Boolean.toString(isDurableWrites())); return builder.toString(); } Keyspace(String keyspaceName); String getKeyspaceName(); Keyspace withoutDurableWrites(); Keyspace with(ReplicationStrategy replicationStrategy); boolean isDurableWrites(); ReplicationStrategy getReplicationStrategy(); String getCqlStatement();  }
@Test public void shouldCreateCqlStatementWithSimpleStrategyWhenNoStrategyGiven() { Keyspace keyspace = new Keyspace("test"); assertThat(keyspace.getCqlStatement(), is(equalTo( "CREATE KEYSPACE IF NOT EXISTS test WITH REPLICATION = {'class':'SimpleStrategy','replication_factor':1} " + "AND DURABLE_WRITES = true" ))); }