|
19 | 19 | import com.example.bigtable.MobileTimeSeriesBaseTest;
|
20 | 20 | import com.google.api.gax.rpc.ServerStream;
|
21 | 21 | import com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient;
|
| 22 | +import com.google.cloud.bigtable.admin.v2.models.ColumnFamily; |
22 | 23 | import com.google.cloud.bigtable.data.v2.BigtableDataClient;
|
23 | 24 | import com.google.cloud.bigtable.data.v2.models.Query;
|
24 | 25 | import com.google.cloud.bigtable.data.v2.models.Row;
|
25 | 26 | import com.google.cloud.bigtable.data.v2.models.RowCell;
|
26 | 27 | import com.google.cloud.bigtable.data.v2.models.TableId;
|
| 28 | +import com.google.common.truth.Correspondence; |
27 | 29 | import com.google.common.truth.Truth;
|
28 | 30 | import java.io.IOException;
|
29 | 31 | import java.util.List;
|
|
39 | 41 | */
|
40 | 42 | @FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
41 | 43 | public class DeletesTest extends MobileTimeSeriesBaseTest {
|
| 44 | + private static final Correspondence<ColumnFamily, String> COLUMN_FAMILY_ID_CORRESPONDENCE = |
| 45 | + Correspondence.transforming(ColumnFamily::getId, "ColumnFamily id"); |
42 | 46 | public static BigtableDataClient bigtableDataClient;
|
43 | 47 |
|
44 | 48 | @BeforeClass
|
@@ -164,13 +168,17 @@ public void test6_testDeleteFromColumnFamily() throws IOException {
|
164 | 168 | public void test7_testDeleteColumnFamily() throws IOException {
|
165 | 169 | try (BigtableTableAdminClient tableAdminClient =
|
166 | 170 | BigtableTableAdminClient.create(projectId, instanceId)) {
|
167 |
| - Truth.assertThat(tableAdminClient.getTable(TABLE_ID).getColumnFamilies().size()).isEqualTo(2); |
| 171 | + Truth.assertThat(tableAdminClient.getTable(TABLE_ID).getColumnFamilies()) |
| 172 | + .comparingElementsUsing(COLUMN_FAMILY_ID_CORRESPONDENCE) |
| 173 | + .contains(COLUMN_FAMILY_NAME_STATS); |
168 | 174 |
|
169 | 175 | DeleteColumnFamilyExample deleteColumnFamilyExample = new DeleteColumnFamilyExample();
|
170 | 176 | deleteColumnFamilyExample.deleteColumnFamily(
|
171 | 177 | projectId, instanceId, TABLE_ID, COLUMN_FAMILY_NAME_STATS);
|
172 | 178 |
|
173 |
| - Truth.assertThat(tableAdminClient.getTable(TABLE_ID).getColumnFamilies().size()).isEqualTo(1); |
| 179 | + Truth.assertThat(tableAdminClient.getTable(TABLE_ID).getColumnFamilies()) |
| 180 | + .comparingElementsUsing(COLUMN_FAMILY_ID_CORRESPONDENCE) |
| 181 | + .doesNotContain(COLUMN_FAMILY_NAME_STATS); |
174 | 182 | }
|
175 | 183 | }
|
176 | 184 |
|
|
0 commit comments