@Test void initializeShouldExecuteCreateStatementAndReturnFullWhenTableDoesNotExist() { KeyspaceMetadata keyspace = mock(KeyspaceMetadata.class); when(keyspace.getTable(NAME)).thenReturn(null); Session session = mock(Session.class); assertThat(TABLE.initialize(keyspace, session)) .isEqualByComparingTo(FULL); verify(keyspace).getTable(NAME); verify(session).execute(STATEMENT); }
public InitializationStatus initialize(KeyspaceMetadata keyspaceMetadata, Session session) { if (keyspaceMetadata.getTable(name) != null) { return InitializationStatus.ALREADY_DONE; } session.execute(createStatement); return InitializationStatus.FULL; }
CassandraTable { public InitializationStatus initialize(KeyspaceMetadata keyspaceMetadata, Session session) { if (keyspaceMetadata.getTable(name) != null) { return InitializationStatus.ALREADY_DONE; } session.execute(createStatement); return InitializationStatus.FULL; } }
CassandraTable { public InitializationStatus initialize(KeyspaceMetadata keyspaceMetadata, Session session) { if (keyspaceMetadata.getTable(name) != null) { return InitializationStatus.ALREADY_DONE; } session.execute(createStatement); return InitializationStatus.FULL; } CassandraTable(String name, Statement createStatement); }
CassandraTable { public InitializationStatus initialize(KeyspaceMetadata keyspaceMetadata, Session session) { if (keyspaceMetadata.getTable(name) != null) { return InitializationStatus.ALREADY_DONE; } session.execute(createStatement); return InitializationStatus.FULL; } CassandraTable(String name, Statement createStatement); String getName(); InitializationStatus initialize(KeyspaceMetadata keyspaceMetadata, Session session); @Override final boolean equals(Object o); @Override final int hashCode(); @Override String toString(); }
CassandraTable { public InitializationStatus initialize(KeyspaceMetadata keyspaceMetadata, Session session) { if (keyspaceMetadata.getTable(name) != null) { return InitializationStatus.ALREADY_DONE; } session.execute(createStatement); return InitializationStatus.FULL; } CassandraTable(String name, Statement createStatement); String getName(); InitializationStatus initialize(KeyspaceMetadata keyspaceMetadata, Session session); @Override final boolean equals(Object o); @Override final int hashCode(); @Override String toString();  }