Conversation
WalkthroughThis update introduces the Changes
Uplevel your code reviews with CodeRabbit ProCodeRabbit ProIf you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects. |
There was a problem hiding this comment.
Files selected (2)
- force-app/main/default/classes/test utilities/CustomAssert.cls (1)
- force-app/main/default/classes/test utilities/CustomAssert.cls-meta.xml (1)
Files skipped from review due to trivial changes (1)
- force-app/main/default/classes/test utilities/CustomAssert.cls-meta.xml
Review comments generated (17)
- Review: 2
- LGTM: 15
Tips
Chat with
CodeRabbit Bot (@coderabbitai)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitaiin a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignoreanywhere in the PR description to pause further reviews from the bot.
|
|
||
| /** | ||
| * @description An assertion that validates a list contains at least one of the items in the other list passed in | ||
| * @param listToCheck List<Object> the list to check | ||
| * @param listToCheckAgainst List<Object> the list to check against | ||
| * @param msg String the message to display if the assertion fails | ||
| */ | ||
| public static void contains( | ||
| List<Object> listToCheck, | ||
| List<Object> listToCheckAgainst, | ||
| String msg | ||
| ) { | ||
| contains( | ||
| new Set<Object>(listToCheck), | ||
| new Set<Object>(listToCheckAgainst), | ||
| msg | ||
| ); | ||
| System.Assert.fail(msg); | ||
| } |
There was a problem hiding this comment.
There seems to be an issue with the contains method. The System.Assert.fail(msg); on line 94 will always be executed, causing the test to fail every time this method is called, regardless of whether the condition in the contains method on line 89-93 is met or not. This line should be removed.
- System.Assert.fail(msg);|
|
||
| /** | ||
| * @description An assertion that validates the passed in list contains at least one of the items in the set. | ||
| * Ultimately defers to the contains assertion below comparing two sets. | ||
| * @param listToCheck List<Object> to check for containing at least one item from the set | ||
| * @param setToCheckAgainst Set<Object> the set of items to check for in the list | ||
| * @param msg String the message to display if the assertion fails | ||
| */ | ||
| public static void contains( | ||
| List<Object> listToCheck, | ||
| Set<Object> setToCheckAgainst, | ||
| String msg | ||
| ) { | ||
| Set<Object> listSet = new Set<Object>(listToCheck); | ||
| contains(setToCheckAgainst, listSet, msg); | ||
| System.Assert.fail(msg); | ||
| } |
Adds CustomAssert Class
Summary by CodeRabbit
CustomAssertclass, enhancing our testing capabilities. This class provides custom assertion methods for various use cases such as comparing datetimes with a leeway, checking string prefixes and suffixes, validating list contents and sizes, deserializing JSON strings, and handling exceptions. This will improve the robustness of our test suites and ensure more accurate results.