-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/custom assertions #110
Open
codefriar
wants to merge
16
commits into
main
Choose a base branch
from
feat/CustomAssertions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
74ae41a
not ready for consumption at the moment.
codefriar 9321f4a
Feat(Assertions): Adds Shadow Assert Class
codefriar de7ebbd
not ready for consumption at the moment.
codefriar 8ed10a6
Feat(Assertions): Adds Shadow Assert Class
codefriar e7c081b
feat(Assert): adding isNotJanky
codefriar 81f5e01
feat(Assert): adding isNotJanky
codefriar 4aee28b
Merge branch 'feat/CustomAssertions' of https://github.com/codefriar/…
dschach 4dd2eef
adding a comment with some future assert methods to write.
codefriar 1a11a10
testing gpt sources.
codefriar 0fdedfb
fix(ci): updating gpt review action
codefriar 0ba864b
refactor(CAssert, ci-pr.yml): Refactoring Assert
codefriar c54b789
Merge branch 'main' into feat/CustomAssertions
codefriar 66248d1
fix(CAssert): adding pmd suprression for a method
codefriar dc2ea9e
Merge branch 'main' into feat/CustomAssertions
codefriar 7897308
fix(project-scratch-def): removing pre-release
codefriar a5b7261
feat: case insensitive assertions
dschach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
`APIVERSION: 58` | ||
|
||
`STATUS: ACTIVE` | ||
|
||
## Methods | ||
|
||
### `public static void areEqual(Datetime expectedDatetime, Datetime actualDatetime, Integer timeVarianceSeconds, String msg)` | ||
|
||
`SUPPRESSWARNINGS` | ||
|
||
Assertion method to validate that two Datetime objects are equal within a given leeway | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| --------------------- | ------------------------------------------------------ | | ||
| `expectedDatetime` | Datetime - the expected Datetime | | ||
| `actualDatetime` | Datetime - the actual Datetime | | ||
| `timeVarianceSeconds` | Integer - the number of seconds of leeway to allow | | ||
| `msg` | String - the message to display if the assertion fails | | ||
|
||
### `public static void startsWith(String str, String prefix, String msg)` | ||
|
||
Assertion method to validate that a string starts with the given string | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| -------- | ------------------------------------------------------ | | ||
| `str` | String - the string to validate | | ||
| `prefix` | String - the prefix the string must start with | | ||
| `msg` | String - the message to display if the assertion fails | | ||
|
||
### `public static void startsWithIgnoreCase(String str, String prefix, String msg)` | ||
|
||
Assertion method to validate that a string starts with the given string (case insensitive) | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| -------- | ----------------------------------------------------------------- | | ||
| `str` | String - the string to validate | | ||
| `prefix` | String - the prefix the string must start with (case insensitive) | | ||
| `msg` | String - the message to display if the assertion fails | | ||
|
||
### `public static void endsWith(String str, String suffix, String msg)` | ||
|
||
Assertion method to validate that a string ends with the given string | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| -------- | ------------------------------------------------------ | | ||
| `str` | String - the string to validate | | ||
| `suffix` | String - the suffix the string must end with | | ||
| `msg` | String - the message to display if the assertion fails | | ||
|
||
### `public static void endsWithIgnoreCase(String str, String suffix, String msg)` | ||
|
||
Assertion method to validate that a string ends with the given string (case insensitive) | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| -------- | ------------------------------------------------------ | | ||
| `str` | String - the string to validate (case insensitive) | | ||
| `suffix` | String - the suffix the string must end with | | ||
| `msg` | String - the message to display if the assertion fails | | ||
|
||
### `public static void contains(List<Object> listToCheck, List<Object> listToCheckAgainst, String msg)` | ||
|
||
An assertion that validates a list contains at least one of the items in the other list passed in | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| -------------------- | ---------------------------------------------------- | | ||
| `listToCheck` | List<Object> the list to check | | ||
| `listToCheckAgainst` | List<Object> the list to check against | | ||
| `msg` | String the message to display if the assertion fails | | ||
|
||
### `public static void contains(List<Object> listToCheck, Set<Object> setToCheckAgainst, String msg)` | ||
|
||
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. | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| ------------------- | ------------------------------------------------------------------- | | ||
| `listToCheck` | List<Object> to check for containing at least one item from the set | | ||
| `setToCheckAgainst` | Set<Object> the set of items to check for in the list | | ||
| `msg` | String the message to display if the assertion fails | | ||
|
||
### `public static void contains(Set<Object> setToCheck, Set<Object> setToCheckAgainst, String msg)` | ||
|
||
Checks to see if a set contains any of the items in another set. | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| ------------------- | ---------------------------------------------------- | | ||
| `setToCheck` | Set<Object> the set to check | | ||
| `setToCheckAgainst` | Set<Object> the set to check against | | ||
| `msg` | String the message to display if the assertion fails | | ||
|
||
### `public static void isNotJanky(String msg)` | ||
|
||
Look, this is a quasi inside joke method. If you have to ask if it's janky, it is. For more information, ask | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| ----- | ---------------------------------------------------- | | ||
| `msg` | String the message you want in your failure response | | ||
|
||
**JeffKrantz** over on SFDC Discord. | ||
|
||
### `public static void listMeetsMinimumSize(List<Object> collection, Integer minSize, String msg)` | ||
|
||
An assertion that validates a list is at least a certain size | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| ------------ | ------------------------------------------------------ | | ||
| `collection` | List<Object> - the list to validate | | ||
| `minSize` | Integer - the minimum size the list must be | | ||
| `msg` | String - the message to display if the assertion fails | | ||
|
||
### `public static void stringIsDeserializableAsUntypedJson(String jsonString, String msg)` | ||
|
||
An assertion that validates a string is deserializable to untyped JSON | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| ------------ | ------------------------------------------------------ | | ||
| `jsonString` | String - the string to validate | | ||
| `msg` | String - the message to display if the assertion fails | | ||
|
||
### `public static void isSObject(Object obj, String msg)` | ||
|
||
An assertion to validate that the object is an SObject | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| ----- | ------------------------------------------------------ | | ||
| `obj` | Object - the object to validate | | ||
| `msg` | String - the message to display if the assertion fails | | ||
|
||
### `public static void caughtExpectedException(Exception incomingException, Type expectedExceptionType, String msg)` | ||
|
||
An assertion to validate that the exception is of the expected type | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| ----------------------- | ------------------------------------------------------ | | ||
| `incomingException` | Exception - the exception to validate | | ||
| `expectedExceptionType` | Type - the expected type of the exception | | ||
| `msg` | String - the message to display if the assertion fails | | ||
|
||
### `public static void caughtExpectedException(Exception incomingException, Type expectedExceptionType, String expectedExceptionMessage, String msg)` | ||
|
||
An assertion to validate that the exception is of the expected type and contains the expected message | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| -------------------------- | -------------------------------------------------------------------- | | ||
| `incomingException` | Exception - the exception to validate | | ||
| `expectedExceptionType` | Type - the expected type of the exception | | ||
| `expectedExceptionMessage` | String - A string that must exist in the resulting exception message | | ||
| `msg` | String - the message to display if the assertion fails | | ||
|
||
### `public static void isInRange(Integer value, Integer min, Integer max, String msg)` | ||
|
||
An assertion that validates the given value is within a given range | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| ------- | ------------------------------------------------------ | | ||
| `value` | Integer - the value to validate | | ||
| `min` | Integer - the minimum value the value must be | | ||
| `max` | Integer - the maximum value the value must be | | ||
| `msg` | String - the message to display if the assertion fails | | ||
|
||
### `public static void logsWereGenerated(String msg)` | ||
|
||
An Assertion that validates that LogEvent\_\_c records were generated. Note: this relies on the Log class that's part of ApexKit | ||
|
||
#### Parameters | ||
|
||
| Param | Description | | ||
| ----- | ------------------------------------------------------ | | ||
| `msg` | String - the message to display if the assertion fails | | ||
|
||
### `public static void logsWereGenerated()` | ||
|
||
An assertion that validates that LogEvent\_\_c records were generated. Note this relies on the Log class that's part of ApexKit. This method override accepts no parameters but delegates to the variant above by specifying a default message. | ||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
CAssert
class is mentioned in the documentation, but there's no description provided for it. It would be helpful to include a brief explanation of what this class does and how it can be used.