ApexKit icon indicating copy to clipboard operation
ApexKit copied to clipboard

Feat/custom assertions

Open codefriar opened this issue 2 years ago • 5 comments

Adds a 'shadow' Assert class that facilitates developers adding custom assertion methods that can still be cleanly read as Assert.methodName

Closes #104

Summary by CodeRabbit

  • New Feature: Introduced a new Assert class with custom assertion methods for various conditions, enhancing the testing capabilities.
  • Refactor: Updated return types of several methods across multiple classes to improve type safety and clarity.
  • Documentation: Revised documentation for numerous classes, improving descriptions of methods and their return types.
  • Test: Added visibility to certain enum constants for testing purposes.
  • Chore: Minor changes in formatting and phrasing in the codebase's documentation.

codefriar avatar Oct 04 '23 07:10 codefriar

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (671272e) 95.00% compared to head (a5b7261) 95.00%. Report is 23 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #110   +/-   ##
=======================================
  Coverage   95.00%   95.00%           
=======================================
  Files          32       32           
  Lines        2002     2002           
=======================================
  Hits         1902     1902           
  Misses        100      100           
Flag Coverage Δ
Apex 95.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 04 '23 07:10 codecov[bot]

It doesn’t! That’s it’s beauty On Oct 4, 2023 at 09:15 -0700, David Schach @.***>, wrote:

@dschach requested changes on this pull request. This class name requires all other Assert statements to use System.Assert? If so, it probably needs a new name. In force-app/main/default/classes/test utilities/Assert.cls:

@@ -0,0 +1,330 @@ +/**

    • @description Assert class 'shadows' the System.Assert class allowing us to add custom assertion methods accessed
    • via the static Assert.* methods. This allows us to add custom assertion methods that are more readable and provide
    • more flexibility and functionality than the standard System.Assert methods. Ultimately the goal is to provide
    • end-developers with a more readable and flexible way to write assertions.
  • / @.('PMD.ExcessivePublicCount, PMD.ExcessiveParameterList') +public with sharing class Assert { If this class requires all other tests to use System.Assert, then Assert is probably not a good name for the class. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.*>

codefriar avatar Oct 04 '23 17:10 codefriar

Image description CodeRabbit

Walkthrough

This pull request introduces a new Assert class with custom assertion methods for various conditions, and modifies the return types of several methods across multiple classes to improve type safety. It also includes updates to the documentation reflecting these changes.

Changes

Files Summary
CAssert.md, CAssert.cls, CAssert.cls-meta.xml Added a new Assert class with custom assertion methods for validating different conditions.
BulkCallable.md, CustomInvocable.md, FeatureFlag.md, HttpCalloutMockFactory.md, CanTheUserTests.md, FeatureFlagCommonTests.md, FeatureFlagDataProvider.md, MetadataTriggerQueryService.md, MockedMethod.md, Query.md, SOQL.md, SOQLAgregate.md, SOSL.md, Safely.md, StubUtilities.md, TestFactory.md, QueueableProcess.md, RestClientLib.md, UFInvocable.md, UniversalBulkInvocable.md, UniversalFlowInputOutput.md, UniversalInvocable.md Modified the return types of several methods in various classes to improve type safety.
RestLib.md, RestLibApiCall.md, TriggerContext.md, TriggerFrameworkLoopCount.md Updated the documentation to reflect the changes in method return types.
home.md Mentioned the addition of a 'shadow' Assert class and two other classes, AsyncRestApi and CachePartitionType.

🐇💻

"In the land of code where the shadows lie, An Assert class was born under the AI's eye. With custom methods, it stands tall, Ensuring type safety for one and all. The docs were updated, the changes were made, In the realm of code, the rabbit played. Celebrate these changes, for they are neat, Making our codebase incredibly sweet!" 🎉🥕


Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If 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.

github-actions[bot] avatar Oct 18 '23 23:10 github-actions[bot]

@dschach - I've refactored this into a new class name and reverted the shadowing work. It shows I have an outstanding request for change, but I can't find it. Thoughts on this?

codefriar avatar Oct 18 '23 23:10 codefriar

Approved

dschach avatar Apr 03 '24 17:04 dschach