This project is a collection of programming exercises from Exercism ported to Salesforce.
Usually this will be as pure Apex code, but as the exercise may merit, some solutions may also include SObjects, Lightning Web Components, or other Salesforce technologies.
When possible SObjects have been preferred over "pure" Apex _metadata.objects because SObjects allow for named parameters, accessing by SObjectField, and potentially other properties and methods which may prove desirable.
Exercism Name | Other Names | Project Prefix |
---|---|---|
Allergies | ALP_ALG_ | |
Annalyn's Infiltration | ALP_AINF_ | |
Bird Watcher | ALP_BWTCH_ | |
Bowling | ALP_BOWL_ | |
Calculator Conundrum | ALP_CALC_ | |
Connect | Hex / Polygon / CON-TAC-TIX | ALP_CONX_ |
Cook your lasagna | ALP_LSGN_ | |
Custom Set | ALP_CSET_ | |
Crypto Square | ALP_CSQ_ | |
Elon's Toy Car | ALP_ETC_ | |
Hello World | ALP_HW_ | |
Karl's Languages | ALP_KLNG_ | |
Largest Series Product | ALP_LSP_ | |
Matching Brackets | ALP_MBKT_ | |
Minesweeper | ALP_MNSP_ | |
Poker | ALP_POKR_ | |
Simple Cipher | Caesar Cipher | ALP_SCIP_ |
Sieve | Sieve of Eratosthenes | ALP_SIVE_ |
Spiral Matrix | ALP_SMTX_ | |
Squeaky Clean | ALP_SCLN_ |
While for real world project I generally advocate Martin Fowler's Test Pyramid, for these exercises, I've followed a philosophy of Lean Testing, only included Apex adaptations of the original challenges.
Tests can and should be executed as normal when or after being deployed to any Salesforce org.
I recommend execution with IntelliJ IDEA Illuminated Cloud,
however it they can also be executed with Salesforce's built in Developer Console.
(i.e., through the Developer Console, through the Metadata API by way of any IDE or build too, etc.)
In order to ensure consistent test execution, all tests uses:
Test.startTest()
Test.stopTest()
System.runAs()
Test Users are generated leveraging the eXtreme Apex Test Data Factory (XFT).
This is overkill for pure Apex projects, but may be useful if/when some exercises also use other SObjects.
Test framework code uses two prefixes:
Prefix | Description |
---|---|
XFTY_ | Code belonging to the extreme Apex Test Data Factory |
TEST_ | Code which is or may be modified to be specific to this project |
The class XFTY_DummySObjectFactoryOutletLookup
leverages the Business Delegate Pattern to
locate required "FactoryOutlets" which contain the specifications for each SObject.