Skip to content

Strengthen and modernize assertions in EncryptionRecipesTest #738

Description

@manuelepalmeri

While reading through the test suite I noticed that EncryptionRecipesTest.cls has two related test-quality issues. I'd like to work on fixing them if the maintainers agree.

1. Tautological assertions that always pass — the three "success" tests (hashRecipesWhenSuccessTest L66, hmacRecipesWhenSuccessTest L107, digitalSignatureRecipesWhenSuccessTest L153) end with System.assert(true, 'No error was expected'), which passes unconditionally and verifies nothing.
Proposal: replace with a meaningful assertion on the generated value (e.g. System.Assert.isNotNull(hmac, ...)).

2. Legacy assertion API — the file uses System.assert() and System.assertEquals() while the rest of the suite uses the modern System.Assert class.
Proposal: migrate to System.Assert class

Scope: limited to force-app/tests/Encryption Recipes/EncryptionRecipesTest.cls

Happy to adjust the scope based on your preference.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions