Program: 37620
Project: 37620
Buggy source:
@Test public void canCRUDSqlServerWithFirewallRule() throws Exception {
  String rgName=RG_NAME;
  String sqlServerName=SQL_SERVER_NAME;
  String sqlServerAdminName="String_Node_Str";
  String id=SdkContext.randomUuid();
  SqlServer sqlServer=sqlServerManager.sqlServers().define(SQL_SERVER_NAME).withRegion(Region.US_CENTRAL).withNewResourceGroup(RG_NAME).withAdministratorLogin(sqlServerAdminName).withAdministratorPassword("String_Node_Str").withActiveDirectoryAdministrator("String_Node_Str",id).withoutAccessFromAzureServices().defineFirewallRule("String_Node_Str").withIPAddress("String_Node_Str").attach().create();
  Assert.assertEquals(sqlServerAdminName,sqlServer.administratorLogin());
  Assert.assertEquals("String_Node_Str",sqlServer.kind());
  Assert.assertEquals("String_Node_Str",sqlServer.version());
  sqlServer=sqlServerManager.sqlServers().getByResourceGroup(RG_NAME,SQL_SERVER_NAME);
  Assert.assertEquals(sqlServerAdminName,sqlServer.administratorLogin());
  Assert.assertEquals("String_Node_Str",sqlServer.kind());
  Assert.assertEquals("String_Node_Str",sqlServer.version());
  SqlActiveDirectoryAdministrator sqlADAdmin=sqlServer.getActiveDirectoryAdministrator();
  Assert.assertNotNull(sqlADAdmin);
  Assert.assertEquals("String_Node_Str",sqlADAdmin.signInName());
  Assert.assertNotNull(sqlADAdmin.id());
  Assert.assertEquals("String_Node_Str",sqlADAdmin.administratorType());
  sqlADAdmin=sqlServer.setActiveDirectoryAdministrator("String_Node_Str",id);
  Assert.assertNotNull(sqlADAdmin);
  Assert.assertEquals("String_Node_Str",sqlADAdmin.signInName());
  Assert.assertNotNull(sqlADAdmin.id());
  Assert.assertEquals("String_Node_Str",sqlADAdmin.administratorType());
  sqlServer.removeActiveDirectoryAdministrator();
  sqlADAdmin=sqlServer.getActiveDirectoryAdministrator();
  Assert.assertNull(sqlADAdmin);
  SqlFirewallRule firewallRule=sqlServerManager.sqlServers().firewallRules().getBySqlServer(RG_NAME,SQL_SERVER_NAME,"String_Node_Str");
  Assert.assertEquals("String_Node_Str",firewallRule.startIPAddress());
  Assert.assertEquals("String_Node_Str",firewallRule.endIPAddress());
  firewallRule=sqlServerManager.sqlServers().firewallRules().getBySqlServer(RG_NAME,SQL_SERVER_NAME,"String_Node_Str");
  Assert.assertNull(firewallRule);
  sqlServer.enableAccessFromAzureServices();
  firewallRule=sqlServerManager.sqlServers().firewallRules().getBySqlServer(RG_NAME,SQL_SERVER_NAME,"String_Node_Str");
  Assert.assertEquals("String_Node_Str",firewallRule.startIPAddress());
  Assert.assertEquals("String_Node_Str",firewallRule.endIPAddress());
  sqlServer.update().withNewFirewallRule("String_Node_Str","String_Node_Str","String_Node_Str").apply();
  sqlServer.firewallRules().delete("String_Node_Str");
  Assert.assertNull(sqlServer.firewallRules().get("String_Node_Str"));
  firewallRule=sqlServerManager.sqlServers().firewallRules().define("String_Node_Str").withExistingSqlServer(RG_NAME,SQL_SERVER_NAME).withIPAddress("String_Node_Str").create();
  Assert.assertEquals("String_Node_Str",firewallRule.startIPAddress());
  Assert.assertEquals("String_Node_Str",firewallRule.endIPAddress());
  firewallRule=firewallRule.update().withStartIPAddress("String_Node_Str").apply();
  Assert.assertEquals("String_Node_Str",firewallRule.startIPAddress());
  Assert.assertEquals("String_Node_Str",firewallRule.endIPAddress());
  sqlServer.firewallRules().delete("String_Node_Str");
  firewallRule=sqlServerManager.sqlServers().firewallRules().getBySqlServer(RG_NAME,SQL_SERVER_NAME,"String_Node_Str");
  Assert.assertNull(firewallRule);
  firewallRule=sqlServer.firewallRules().define("String_Node_Str").withIPAddress("String_Node_Str").create();
  Assert.assertEquals("String_Node_Str",firewallRule.startIPAddress());
  Assert.assertEquals("String_Node_Str",firewallRule.endIPAddress());
  firewallRule.delete();
}

Fixed version (ground truth):
@Test public void canCRUDSqlServerWithFirewallRule() throws Exception {
  String rgName=RG_NAME;
  String sqlServerName=SQL_SERVER_NAME;
  String sqlServerAdminName="String_Node_Str";
  String id=SdkContext.randomUuid();
  SqlServer sqlServer=sqlServerManager.sqlServers().define(SQL_SERVER_NAME).withRegion(Region.US_CENTRAL).withNewResourceGroup(RG_NAME).withAdministratorLogin(sqlServerAdminName).withAdministratorPassword("String_Node_Str").withActiveDirectoryAdministrator("String_Node_Str",id).withoutAccessFromAzureServices().defineFirewallRule("String_Node_Str").withIPAddress("String_Node_Str").attach().withTag("String_Node_Str","String_Node_Str").create();
  Assert.assertEquals(sqlServerAdminName,sqlServer.administratorLogin());
  Assert.assertEquals("String_Node_Str",sqlServer.kind());
  Assert.assertEquals("String_Node_Str",sqlServer.version());
  sqlServer=sqlServerManager.sqlServers().getByResourceGroup(RG_NAME,SQL_SERVER_NAME);
  Assert.assertEquals(sqlServerAdminName,sqlServer.administratorLogin());
  Assert.assertEquals("String_Node_Str",sqlServer.kind());
  Assert.assertEquals("String_Node_Str",sqlServer.version());
  SqlActiveDirectoryAdministrator sqlADAdmin=sqlServer.getActiveDirectoryAdministrator();
  Assert.assertNotNull(sqlADAdmin);
  Assert.assertEquals("String_Node_Str",sqlADAdmin.signInName());
  Assert.assertNotNull(sqlADAdmin.id());
  Assert.assertEquals("String_Node_Str",sqlADAdmin.administratorType());
  sqlADAdmin=sqlServer.setActiveDirectoryAdministrator("String_Node_Str",id);
  Assert.assertNotNull(sqlADAdmin);
  Assert.assertEquals("String_Node_Str",sqlADAdmin.signInName());
  Assert.assertNotNull(sqlADAdmin.id());
  Assert.assertEquals("String_Node_Str",sqlADAdmin.administratorType());
  sqlServer.removeActiveDirectoryAdministrator();
  sqlADAdmin=sqlServer.getActiveDirectoryAdministrator();
  Assert.assertNull(sqlADAdmin);
  SqlFirewallRule firewallRule=sqlServerManager.sqlServers().firewallRules().getBySqlServer(RG_NAME,SQL_SERVER_NAME,"String_Node_Str");
  Assert.assertEquals("String_Node_Str",firewallRule.startIPAddress());
  Assert.assertEquals("String_Node_Str",firewallRule.endIPAddress());
  firewallRule=sqlServerManager.sqlServers().firewallRules().getBySqlServer(RG_NAME,SQL_SERVER_NAME,"String_Node_Str");
  Assert.assertNull(firewallRule);
  sqlServer.enableAccessFromAzureServices();
  firewallRule=sqlServerManager.sqlServers().firewallRules().getBySqlServer(RG_NAME,SQL_SERVER_NAME,"String_Node_Str");
  Assert.assertEquals("String_Node_Str",firewallRule.startIPAddress());
  Assert.assertEquals("String_Node_Str",firewallRule.endIPAddress());
  sqlServer.update().withNewFirewallRule("String_Node_Str","String_Node_Str","String_Node_Str").apply();
  sqlServer.firewallRules().delete("String_Node_Str");
  Assert.assertNull(sqlServer.firewallRules().get("String_Node_Str"));
  firewallRule=sqlServerManager.sqlServers().firewallRules().define("String_Node_Str").withExistingSqlServer(RG_NAME,SQL_SERVER_NAME).withIPAddress("String_Node_Str").create();
  Assert.assertEquals("String_Node_Str",firewallRule.startIPAddress());
  Assert.assertEquals("String_Node_Str",firewallRule.endIPAddress());
  firewallRule=firewallRule.update().withStartIPAddress("String_Node_Str").apply();
  Assert.assertEquals("String_Node_Str",firewallRule.startIPAddress());
  Assert.assertEquals("String_Node_Str",firewallRule.endIPAddress());
  sqlServer.firewallRules().delete("String_Node_Str");
  firewallRule=sqlServerManager.sqlServers().firewallRules().getBySqlServer(RG_NAME,SQL_SERVER_NAME,"String_Node_Str");
  Assert.assertNull(firewallRule);
  firewallRule=sqlServer.firewallRules().define("String_Node_Str").withIPAddress("String_Node_Str").create();
  Assert.assertEquals("String_Node_Str",firewallRule.startIPAddress());
  Assert.assertEquals("String_Node_Str",firewallRule.endIPAddress());
  firewallRule.delete();
}