forked from apex-enterprise-patterns/fflib-apex-common
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19601ba
commit 71e5297
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
framework/default/ortoo-core/default/classes/utils/tests/DateTimeUtilsTest.cls
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,18 @@ | ||
@isTest | ||
public with sharing class DateTimeUtilsTest | ||
{ | ||
@isTest | ||
private static void getEpochTime_whenCalled_returnsEpochInSeconds() // NOPMD: Test method name format | ||
{ | ||
Test.startTest(); | ||
Long got = DateTimeUtils.getEpochTime(); | ||
Test.stopTest(); | ||
|
||
Integer e9 = Integer.valueOf( got / 1000000000 ); // if you divide the epoch seconds by 10^9, you should get 1 if the date is later than 9th September 2001 | ||
Integer e10 = Integer.valueOf( ( got / 1000000000 ) / 10 ); // if you divide the epoch seconds by 10^10, you should get < 1 if the date is earlier than 20th November 2286 | ||
// need to do it in two steps becayse 10^10 is not a valid integer | ||
|
||
System.assert( e9 > 0, 'getEpochTime, when called, will return the epoch time in seconds - being greater than 10^9' ); | ||
System.assertEquals( 0, e10, 'getEpochTime, when called, will return the epoch time in seconds - being less than 10^10' ); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
framework/default/ortoo-core/default/classes/utils/tests/DateTimeUtilsTest.cls-meta.xml
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,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>52.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
18 changes: 18 additions & 0 deletions
18
framework/default/ortoo-lwc-list-view-buttons/classes/tests/TimeControllerTest.cls
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,18 @@ | ||
@isTest | ||
public with sharing class TimeControllerTest | ||
{ | ||
@isTest | ||
private static void getEpochTime_whenCalled_returnsEpochInSeconds() // NOPMD: Test method name format | ||
{ | ||
Test.startTest(); | ||
Long got = TimeController.getEpochTime(); | ||
Test.stopTest(); | ||
|
||
Integer e9 = Integer.valueOf( got / 1000000000 ); // if you divide the epoch seconds by 10^9, you should get 1 if the date is later than 9th September 2001 | ||
Integer e10 = Integer.valueOf( ( got / 1000000000 ) / 10 ); // if you divide the epoch seconds by 10^10, you should get < 1 if the date is earlier than 20th November 2286 | ||
// need to do it in two steps becayse 10^10 is not a valid integer | ||
|
||
System.assert( e9 > 0, 'getEpochTime, when called, will return the epoch time in seconds - being greater than 10^9' ); | ||
System.assertEquals( 0, e10, 'getEpochTime, when called, will return the epoch time in seconds - being less than 10^10' ); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
framework/default/ortoo-lwc-list-view-buttons/classes/tests/TimeControllerTest.cls-meta.xml
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,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>52.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |