Notes
Account a = new Account(Name = 'xyz');
insert a;
Assert.isNull([SELECT AccountNumber FROM Account WHERE Id =: a.Id].AccountNumber);
Savepoint sp = Database.setSavepoint();
a.AccountNumber = '123';
update a;
Assert.areEqual('123', [SELECT AccountNumber FROM Account WHERE Id =: a.Id].AccountNumber);
Database.rollback(sp);
Assert.isNull([SELECT AccountNumber FROM Account WHERE Id =: a.Id].AccountNumber);
System.debug([SELECT AccountNumber FROM Account WHERE Id =: a.Id].AccountNumber);
Account a = new Account(Name = 'xyz', AccountNumber='999');
insert a;
Assert.areEqual('999', [SELECT AccountNumber FROM Account WHERE Id =: a.Id].AccountNumber);
Savepoint sp = Database.setSavepoint();
a.AccountNumber = '123';
update a;
Assert.areEqual('123', [SELECT AccountNumber FROM Account WHERE Id =: a.Id].AccountNumber);
Database.rollback(sp);
Assert.areEqual('999', [SELECT AccountNumber FROM Account WHERE Id =: a.Id].AccountNumber);
System.debug([SELECT AccountNumber FROM Account WHERE Id =: a.Id].AccountNumber);