From e790c5de8c627392ff99c79eff23c587ee6f1018 Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Mon, 16 Jul 2018 15:37:51 -0400 Subject: [PATCH 1/3] bigtable: fix integration test --- .../cloud/bigtable/admin/v2/it/TableAdminClientIT.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java index 882f1c163ed9..00786c2702a8 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java +++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java @@ -19,6 +19,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import com.google.bigtable.admin.v2.InstanceName; import com.google.bigtable.admin.v2.TableName; @@ -35,7 +36,9 @@ import com.google.protobuf.ByteString; import java.io.IOException; import java.util.List; +import org.hamcrest.CoreMatchers; import org.junit.AfterClass; +import org.junit.Assert; import org.junit.AssumptionViolatedException; import org.junit.Before; import org.junit.BeforeClass; @@ -196,7 +199,7 @@ public void listTables() { tableAdmin.createTable(TableAdminRequests.createTable(tableId)); List tables = tableAdmin.listTables(); assertNotNull(tables); - assertEquals(1, tables.size()); + assertTrue("List tables did not return any tables", tables.size() > 0); } finally { tableAdmin.deleteTable(tableId); } @@ -210,7 +213,7 @@ public void listTablesAsync() throws Exception { tableAdmin.createTable(TableAdminRequests.createTable(tableId)); List tables = tableAdmin.listTablesAsync().get(); assertNotNull(tables); - assertEquals(1, tables.size()); + assertTrue("List tables did not return any tables", tables.size() > 0); } finally { tableAdmin.deleteTable(tableId); } From 95619f3c8264f0bf95fb78ba39d5cf240e88285e Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Mon, 16 Jul 2018 16:34:00 -0400 Subject: [PATCH 2/3] remove unused imports --- .../google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java index 00786c2702a8..f7f7458d82f7 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java +++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java @@ -19,8 +19,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; + import com.google.bigtable.admin.v2.InstanceName; import com.google.bigtable.admin.v2.TableName; import com.google.cloud.bigtable.admin.v2.TableAdminClient; @@ -36,9 +36,7 @@ import com.google.protobuf.ByteString; import java.io.IOException; import java.util.List; -import org.hamcrest.CoreMatchers; import org.junit.AfterClass; -import org.junit.Assert; import org.junit.AssumptionViolatedException; import org.junit.Before; import org.junit.BeforeClass; From 519c4e900f23ba86fa1e47ada627a3552c3c9414 Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Mon, 16 Jul 2018 16:35:17 -0400 Subject: [PATCH 3/3] isEmpty --- .../google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java index f7f7458d82f7..c593dec8be15 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java +++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java @@ -197,7 +197,7 @@ public void listTables() { tableAdmin.createTable(TableAdminRequests.createTable(tableId)); List tables = tableAdmin.listTables(); assertNotNull(tables); - assertTrue("List tables did not return any tables", tables.size() > 0); + assertFalse("List tables did not return any tables", tables.isEmpty()); } finally { tableAdmin.deleteTable(tableId); } @@ -211,7 +211,7 @@ public void listTablesAsync() throws Exception { tableAdmin.createTable(TableAdminRequests.createTable(tableId)); List tables = tableAdmin.listTablesAsync().get(); assertNotNull(tables); - assertTrue("List tables did not return any tables", tables.size() > 0); + assertFalse("List tables did not return any tables", tables.isEmpty()); } finally { tableAdmin.deleteTable(tableId); }