-
Notifications
You must be signed in to change notification settings - Fork 24
Updated the test and mocking classes to use realistic phone numbers, … #2
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
Open
admillican08
wants to merge
1
commit into
main
Choose a base branch
from
Branch_admChangeTests
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
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 hidden or 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 |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ | |
| * https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_httpcalloutmock.htm | ||
| */ | ||
| public with sharing class DummyJSONCalloutMockGenerator implements HttpCalloutMock { | ||
| public static String DUMMY_JSON_USER_PAYLOAD = '{"id": 1, "firstName":"Johnny", "lastName":"Test", "email": "[email protected]", "phone": "+123456789", "birthDate": "1990-01-01", "address": {"address": "123 Test St", "city": "Test City", "postalCode": "12345", "state": "TS", "country": "Testland"}}'; | ||
| public static String DUMMY_JSON_USER_PAYLOAD = '{"id": 1, "firstName":"Johnny", "lastName":"Test", "email": "[email protected]", "phone": "15183425678", "birthDate": "1990-01-01", "address": {"address": "123 Test St", "city": "Schenectady", "postalCode": "12345", "state": "New York", "country": "United States"}}'; | ||
|
|
||
| public HTTPResponse respond(HTTPRequest req) { | ||
| // Create a fake response | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ public with sharing class DummyJSONCalloutTest { | |
|
|
||
| // Assert statements to ensure that the values in the created contact match what was in our mock response. | ||
| System.assertEquals('[email protected]', cont.Email, 'Email does not match your value: ' + cont.Email); | ||
| System.assertEquals('+123456789', cont.Phone, 'Phone does not match your value: ' + cont.Phone); | ||
| System.assertEquals('15183425678', cont.Phone, 'Phone does not match your value: ' + cont.Phone); | ||
| System.assertEquals( | ||
| Date.valueOf('1990-01-01'), | ||
| cont.Birthdate, | ||
|
|
@@ -39,7 +39,7 @@ public with sharing class DummyJSONCalloutTest { | |
| 'MailingStreet does not match your value: ' + cont.MailingStreet | ||
| ); | ||
| System.assertEquals( | ||
| 'Test City', | ||
| 'Schenectady', | ||
| cont.MailingCity, | ||
| 'MailingCity does not match your value: ' + cont.MailingCity | ||
| ); | ||
|
|
@@ -48,9 +48,9 @@ public with sharing class DummyJSONCalloutTest { | |
| cont.MailingPostalCode, | ||
| 'MailingPostalCode does not match your value: ' + cont.MailingPostalCode | ||
| ); | ||
| System.assertEquals('TS', cont.MailingState, 'MailingState does not match your value: ' + cont.MailingState); | ||
| System.assertEquals('New York', cont.MailingState, 'MailingState does not match your value: ' + cont.MailingState); | ||
| System.assertEquals( | ||
| 'Testland', | ||
| 'United States', | ||
| cont.MailingCountry, | ||
| 'MailingCountry does not match your value: ' + cont.MailingCountry | ||
| ); | ||
|
|
@@ -63,7 +63,7 @@ public with sharing class DummyJSONCalloutTest { | |
| FirstName = 'John', | ||
| LastName = 'Doe', | ||
| Email = '[email protected]', | ||
| Phone = '+123456789' | ||
| Phone = '15182349999' | ||
| ); | ||
| insert testContact; | ||
|
|
||
|
|
@@ -93,7 +93,7 @@ public with sharing class DummyJSONCalloutTest { | |
| FirstName = 'John', | ||
| LastName = 'Doe', | ||
| Email = '[email protected]', | ||
| Phone = '1234567890', | ||
| Phone = '15182349999', | ||
| DummyJSON_Id__c = '101' | ||
| ); | ||
| insert testContact; | ||
|
|
@@ -109,7 +109,7 @@ public with sharing class DummyJSONCalloutTest { | |
| System.assertEquals('John', payloadMap.get('firstName'), 'FirstName does not match.'); | ||
| System.assertEquals('Doe', payloadMap.get('lastName'), 'LastName does not match.'); | ||
| System.assertEquals('[email protected]', payloadMap.get('email'), 'Email does not match.'); | ||
| System.assertEquals('1234567890', payloadMap.get('phone'), 'Phone does not match.'); | ||
| System.assertEquals('15182349999', payloadMap.get('phone'), 'Phone does not match.'); | ||
| } | ||
|
|
||
| @isTest | ||
|
|
@@ -122,13 +122,13 @@ public with sharing class DummyJSONCalloutTest { | |
|
|
||
| // Assertions to check if the Contact object was populated correctly | ||
| System.assertEquals('[email protected]', cont.Email, 'Email does not match.'); | ||
| System.assertEquals('+123456789', cont.Phone, 'Phone does not match.'); | ||
| System.assertEquals('15183425678', cont.Phone, 'Phone does not match.'); | ||
| System.assertEquals(Date.valueOf('1990-01-01'), cont.Birthdate, 'Birthdate does not match.'); | ||
| System.assertEquals('123 Test St', cont.MailingStreet, 'MailingStreet does not match.'); | ||
| System.assertEquals('Test City', cont.MailingCity, 'MailingCity does not match.'); | ||
| System.assertEquals('Schenectady', cont.MailingCity, 'MailingCity does not match.'); | ||
| System.assertEquals('12345', cont.MailingPostalCode, 'MailingPostalCode does not match.'); | ||
| System.assertEquals('TS', cont.MailingState, 'MailingState does not match.'); | ||
| System.assertEquals('Testland', cont.MailingCountry, 'MailingCountry does not match.'); | ||
| System.assertEquals('New York', cont.MailingState, 'MailingState does not match.'); | ||
| System.assertEquals('United States', cont.MailingCountry, 'MailingCountry does not match.'); | ||
| } | ||
|
|
||
| @IsTest | ||
|
|
@@ -181,7 +181,7 @@ public with sharing class DummyJSONCalloutTest { | |
| FirstName = 'Test', | ||
| LastName = 'User', | ||
| Email = '[email protected]', | ||
| Phone = '+123456789', | ||
| Phone = '+15182341234', | ||
| DummyJSON_Id__c = '105' | ||
| ); | ||
| insert cont; | ||
|
|
||
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.
Check failure
Code scanning / PMD
Configurable naming conventions for field declarations. This rule reports variable declarations which do not match the regex that applies to their specific kind ---e.g. constants (static final), static field, final field. Each regex can be configured through properties. By default this rule uses the standard Apex naming convention (Camel case). Error