Use dedicated methods rather than asserting something is equal to the true literal

This commit is contained in:
Daniel Ballinger 2026-03-31 11:30:11 +13:00
parent a570c22221
commit f15cd9487b
2 changed files with 2 additions and 2 deletions

View File

@ -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');
```

View File

@ -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');
}
```