@Test
public void testWriteToMultipleTablesValidateConfig() throws Exception {

  CloudBigtableConfiguration config =
      new CloudBigtableConfiguration.Builder()
          .withProjectId("project")
          .withInstanceId("instanceId")
          .build();
  // No error.
  CloudBigtableIO.writeToMultipleTables(config).validate(null);
  // Empty project ID.
  try {
    CloudBigtableIO.writeToMultipleTables(config.toBuilder().withProjectId("").build())
        .validate(null);
    Assert.fail("Expect IllegalArgumentException");
  } catch (IllegalArgumentException e) {
    Assert.assertTrue(e.getMessage().contains("A projectId must be set"));
  }
  // Empty instance ID.
  try {
    CloudBigtableIO.writeToMultipleTables(config.toBuilder().withInstanceId("").build())
        .validate(null);
    Assert.fail("Expect IllegalArgumentException");
  } catch (IllegalArgumentException e) {
    Assert.assertTrue(e.getMessage().contains("A instanceId must be set"));
  }
}