mirror of
https://github.com/forcedotcom/afv-library.git
synced 2026-08-03 21:56:02 +08:00
Use dedicated methods rather than asserting something is equal to the true literal
This commit is contained in:
parent
a570c22221
commit
f15cd9487b
@ -26,7 +26,7 @@ Assert.isTrue(accounts.size() > 0); // vague — use areEqual with exact count
|
||||
### Good: Descriptive message, tests specific behavior
|
||||
|
||||
```apex
|
||||
Assert.areEqual(true, result, 'Service should return true for valid input');
|
||||
Assert.isTrue(result, 'Service should return true for valid input');
|
||||
Assert.areEqual(200, accounts.size(), 'All 200 accounts should be processed');
|
||||
```
|
||||
|
||||
|
||||
@ -140,7 +140,7 @@ static void shouldExecuteFutureMethod() {
|
||||
Test.stopTest();
|
||||
|
||||
Account updated = [SELECT Id, Processed__c FROM Account WHERE Id = :acc.Id];
|
||||
Assert.areEqual(true, updated.Processed__c, 'Future should process record');
|
||||
Assert.isTrue(updated.Processed__c, 'Future should process record');
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user