Program: 37618
Project: 37618
Buggy source:
@Test public void canUseCoolShortcutsForResourceCreation() throws Exception {
  String database2Name="String_Node_Str";
  String database1InEPName="String_Node_Str";
  String database2InEPName="String_Node_Str";
  String elasticPool2Name="String_Node_Str";
  String elasticPool3Name="String_Node_Str";
  String elasticPool1Name=SQL_ELASTIC_POOL_NAME;
  SqlServer sqlServer=sqlServerManager.sqlServers().define(SQL_SERVER_NAME).withRegion(Region.US_CENTRAL).withNewResourceGroup(RG_NAME).withAdministratorLogin("String_Node_Str").withAdministratorPassword("String_Node_Str").withoutAccessFromAzureServices().withNewDatabase(SQL_DATABASE_NAME).withNewDatabase(database2Name).withNewElasticPool(elasticPool1Name,ElasticPoolEditions.STANDARD).withNewElasticPool(elasticPool2Name,ElasticPoolEditions.PREMIUM,database1InEPName,database2InEPName).withNewElasticPool(elasticPool3Name,ElasticPoolEditions.STANDARD).withNewFirewallRule(START_IPADDRESS,END_IPADDRESS,SQL_FIREWALLRULE_NAME).withNewFirewallRule(START_IPADDRESS,END_IPADDRESS).withNewFirewallRule(START_IPADDRESS).create();
  validateMultiCreation(database2Name,database1InEPName,database2InEPName,elasticPool1Name,elasticPool2Name,elasticPool3Name,sqlServer,false);
  elasticPool1Name=SQL_ELASTIC_POOL_NAME + "String_Node_Str";
  database2Name="String_Node_Str";
  database1InEPName="String_Node_Str";
  database2InEPName="String_Node_Str";
  elasticPool2Name="String_Node_Str";
  elasticPool3Name="String_Node_Str";
  sqlServer=sqlServer.update().withNewDatabase(SQL_DATABASE_NAME).withNewDatabase(database2Name).withNewElasticPool(elasticPool1Name,ElasticPoolEditions.STANDARD).withNewElasticPool(elasticPool2Name,ElasticPoolEditions.PREMIUM,database1InEPName,database2InEPName).withNewElasticPool(elasticPool3Name,ElasticPoolEditions.STANDARD).withNewFirewallRule(START_IPADDRESS,END_IPADDRESS,SQL_FIREWALLRULE_NAME).withNewFirewallRule(START_IPADDRESS,END_IPADDRESS).withNewFirewallRule(START_IPADDRESS).apply();
  validateMultiCreation(database2Name,database1InEPName,database2InEPName,elasticPool1Name,elasticPool2Name,elasticPool3Name,sqlServer,true);
  sqlServer.refresh();
  Assert.assertEquals(sqlServer.elasticPools().list().size(),0);
  List<SqlServer> sqlServers=sqlServerManager.sqlServers().listByResourceGroup(RG_NAME);
  boolean found=false;
  for (  SqlServer server : sqlServers) {
    if (server.name().equals(SQL_SERVER_NAME)) {
      found=true;
    }
  }
  Assert.assertTrue(found);
  sqlServer=sqlServerManager.sqlServers().getByResourceGroup(RG_NAME,SQL_SERVER_NAME);
  Assert.assertNotNull(sqlServer);
  sqlServerManager.sqlServers().deleteByResourceGroup(sqlServer.resourceGroupName(),sqlServer.name());
  validateSqlServerNotFound(sqlServer);
}

Fixed version (ground truth):
@Test public void canUseCoolShortcutsForResourceCreation() throws Exception {
  String database2Name="String_Node_Str";
  String database1InEPName="String_Node_Str";
  String database2InEPName="String_Node_Str";
  String elasticPool2Name="String_Node_Str";
  String elasticPool3Name="String_Node_Str";
  String elasticPool1Name=SQL_ELASTIC_POOL_NAME;
  SqlServer sqlServer=sqlServerManager.sqlServers().define(SQL_SERVER_NAME).withRegion(Region.US_CENTRAL).withNewResourceGroup(RG_NAME).withAdministratorLogin("String_Node_Str").withAdministratorPassword("String_Node_Str").withoutAccessFromAzureServices().withNewDatabase(SQL_DATABASE_NAME).withNewDatabase(database2Name).withNewElasticPool(elasticPool1Name,ElasticPoolEditions.STANDARD).withNewElasticPool(elasticPool2Name,ElasticPoolEditions.PREMIUM,database1InEPName,database2InEPName).withNewElasticPool(elasticPool3Name,ElasticPoolEditions.STANDARD).withNewFirewallRule(START_IPADDRESS,END_IPADDRESS,SQL_FIREWALLRULE_NAME).withNewFirewallRule(START_IPADDRESS,END_IPADDRESS).withNewFirewallRule(START_IPADDRESS).create();
  validateMultiCreation(database2Name,database1InEPName,database2InEPName,elasticPool1Name,elasticPool2Name,elasticPool3Name,sqlServer,false);
  elasticPool1Name=SQL_ELASTIC_POOL_NAME + "String_Node_Str";
  database2Name="String_Node_Str";
  database1InEPName="String_Node_Str";
  database2InEPName="String_Node_Str";
  elasticPool2Name="String_Node_Str";
  elasticPool3Name="String_Node_Str";
  sqlServer=sqlServer.update().withNewDatabase(SQL_DATABASE_NAME).withNewDatabase(database2Name).withNewElasticPool(elasticPool1Name,ElasticPoolEditions.STANDARD).withNewElasticPool(elasticPool2Name,ElasticPoolEditions.PREMIUM,database1InEPName,database2InEPName).withNewElasticPool(elasticPool3Name,ElasticPoolEditions.STANDARD).withNewFirewallRule(START_IPADDRESS,END_IPADDRESS,SQL_FIREWALLRULE_NAME).withNewFirewallRule(START_IPADDRESS,END_IPADDRESS).withNewFirewallRule(START_IPADDRESS).withTag("String_Node_Str","String_Node_Str").apply();
  validateMultiCreation(database2Name,database1InEPName,database2InEPName,elasticPool1Name,elasticPool2Name,elasticPool3Name,sqlServer,true);
  sqlServer.refresh();
  Assert.assertEquals(sqlServer.elasticPools().list().size(),0);
  List<SqlServer> sqlServers=sqlServerManager.sqlServers().listByResourceGroup(RG_NAME);
  boolean found=false;
  for (  SqlServer server : sqlServers) {
    if (server.name().equals(SQL_SERVER_NAME)) {
      found=true;
    }
  }
  Assert.assertTrue(found);
  sqlServer=sqlServerManager.sqlServers().getByResourceGroup(RG_NAME,SQL_SERVER_NAME);
  Assert.assertNotNull(sqlServer);
  sqlServerManager.sqlServers().deleteByResourceGroup(sqlServer.resourceGroupName(),sqlServer.name());
  validateSqlServerNotFound(sqlServer);
}