|
12 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | 13 | * See the License for the specific language governing permissions and
|
14 | 14 | * limitations under the License.
|
15 |
| -*/ |
| 15 | + */ |
16 | 16 |
|
17 | 17 | package com.m.examples.bigtable;
|
18 | 18 |
|
19 | 19 | import static org.junit.Assert.assertFalse;
|
20 | 20 | import static org.junit.Assert.assertNotNull;
|
21 | 21 | import static org.junit.Assert.assertTrue;
|
| 22 | +import static org.junit.Assert.fail; |
22 | 23 |
|
23 | 24 | import com.google.api.gax.rpc.NotFoundException;
|
24 | 25 | import com.google.cloud.bigtable.admin.v2.BigtableInstanceAdminClient;
|
|
39 | 40 | import org.junit.BeforeClass;
|
40 | 41 | import org.junit.Test;
|
41 | 42 |
|
42 |
| -/** Integration tests for {@link InstanceAdminExample} */ |
| 43 | +/** |
| 44 | + * Integration tests for {@link InstanceAdminExample} |
| 45 | + */ |
43 | 46 | public class InstanceAdminExampleTest {
|
44 | 47 |
|
45 | 48 | private static final String ID_PREFIX = "instanceadmin";
|
@@ -91,18 +94,22 @@ public void after() {
|
91 | 94 | }
|
92 | 95 |
|
93 | 96 | @Test
|
94 |
| - public void testCreateAndDeleteInstance() throws IOException { |
| 97 | + public void testCreateAndDeleteInstance() { |
95 | 98 | // Creates an instance.
|
96 | 99 | String testInstance = generateId();
|
97 | 100 | String testCluster = generateId();
|
98 |
| - InstanceAdminExample testInstanceAdmin = |
99 |
| - new InstanceAdminExample(projectId, testInstance, testCluster); |
100 |
| - testInstanceAdmin.createProdInstance(); |
101 |
| - assertTrue(adminClient.exists(testInstance)); |
102 |
| - |
103 |
| - // Deletes an instance. |
104 |
| - testInstanceAdmin.deleteInstance(); |
105 |
| - assertFalse(adminClient.exists(testInstance)); |
| 101 | + try { |
| 102 | + InstanceAdminExample testInstanceAdmin = |
| 103 | + new InstanceAdminExample(projectId, testInstance, testCluster); |
| 104 | + testInstanceAdmin.createProdInstance(); |
| 105 | + assertTrue(adminClient.exists(testInstance)); |
| 106 | + // Deletes an instance. |
| 107 | + testInstanceAdmin.deleteInstance(); |
| 108 | + assertFalse(adminClient.exists(testInstance)); |
| 109 | + } catch (Exception e) { |
| 110 | + e.printStackTrace(); |
| 111 | + fail(); |
| 112 | + } |
106 | 113 | }
|
107 | 114 |
|
108 | 115 | @Test
|
|
0 commit comments