1414 limitations under the License.
1515 */
1616
17- @SuppressWarnings(' PMD.ApexDoc, PMD.ApexUnitTestClassShouldHaveRunAs' )
17+ @SuppressWarnings(
18+ ' PMD.ApexDoc, PMD.ApexUnitTestClassShouldHaveRunAs, PMD.CyclomaticComplexity'
19+ )
1820@IsTest(isParallel = true )
1921private class TriggerActionFlowTest {
2022 private static final String BOGUS = ' Bogus' ;
@@ -89,8 +91,7 @@ private class TriggerActionFlowTest {
8991 myException = e ;
9092 }
9193
92- System .Assert .areEqual (
93- null ,
94+ System .Assert .isNull (
9495 myException ,
9596 ' There should be no exception thrown and the System should do nothing when the flow is bypassed'
9697 );
@@ -416,7 +417,8 @@ private class TriggerActionFlowTest {
416417 System .Assert .areNotEqual (null , myException , EXCEPTION_SHOULD_BE_THROWN );
417418 System .Assert .areEqual (
418419 true ,
419- myException .getMessage ().contains (' Type must represent a Flow' ),
420+ myException .getMessage ()
421+ .contains (TriggerActionFlow .TYPE_MUST_REPRESENT_FLOW_ERROR ),
420422 EXCEPTION_SHOULD_HAVE_THE_CORRECT_MESSAGE
421423 );
422424 }
@@ -432,7 +434,8 @@ private class TriggerActionFlowTest {
432434 System .Assert .areNotEqual (null , myException , EXCEPTION_SHOULD_BE_THROWN );
433435 System .Assert .areEqual (
434436 true ,
435- myException .getMessage ().contains (' Type must represent a Flow' ),
437+ myException .getMessage ()
438+ .contains (TriggerActionFlow .TYPE_MUST_REPRESENT_FLOW_ERROR ),
436439 EXCEPTION_SHOULD_HAVE_THE_CORRECT_MESSAGE
437440 );
438441 }
@@ -448,7 +451,8 @@ private class TriggerActionFlowTest {
448451 System .Assert .areNotEqual (null , myException , EXCEPTION_SHOULD_BE_THROWN );
449452 System .Assert .areEqual (
450453 true ,
451- myException .getMessage ().contains (' Type must represent a Flow' ),
454+ myException .getMessage ()
455+ .contains (TriggerActionFlow .TYPE_MUST_REPRESENT_FLOW_ERROR ),
452456 EXCEPTION_SHOULD_HAVE_THE_CORRECT_MESSAGE
453457 );
454458 }
@@ -466,7 +470,59 @@ private class TriggerActionFlowTest {
466470 System .Assert .areNotEqual (null , myException , EXCEPTION_SHOULD_BE_THROWN );
467471 System .Assert .areEqual (
468472 true ,
469- myException .getMessage ().contains (' Flow does not exist' ),
473+ myException .getMessage ()
474+ .contains (TriggerActionFlow .FLOW_DOES_NOT_EXIST_ERROR ),
475+ EXCEPTION_SHOULD_HAVE_THE_CORRECT_MESSAGE
476+ );
477+ }
478+
479+ @IsTest
480+ private static void bypassWithNullTypeShouldThrowException () {
481+ try {
482+ TriggerActionFlow .bypass ((System .Type ) null );
483+ } catch (Exception e ) {
484+ myException = e ;
485+ }
486+
487+ System .Assert .areNotEqual (null , myException , EXCEPTION_SHOULD_BE_THROWN );
488+ System .Assert .areEqual (
489+ true ,
490+ myException .getMessage ()
491+ .contains (TriggerActionFlow .TYPE_MUST_BE_PROVIDED_ERROR ),
492+ EXCEPTION_SHOULD_HAVE_THE_CORRECT_MESSAGE
493+ );
494+ }
495+
496+ @IsTest
497+ private static void clearBypassWithNullTypeShouldThrowException () {
498+ try {
499+ TriggerActionFlow .clearBypass ((System .Type ) null );
500+ } catch (Exception e ) {
501+ myException = e ;
502+ }
503+
504+ System .Assert .areNotEqual (null , myException , EXCEPTION_SHOULD_BE_THROWN );
505+ System .Assert .areEqual (
506+ true ,
507+ myException .getMessage ()
508+ .contains (TriggerActionFlow .TYPE_MUST_BE_PROVIDED_ERROR ),
509+ EXCEPTION_SHOULD_HAVE_THE_CORRECT_MESSAGE
510+ );
511+ }
512+
513+ @IsTest
514+ private static void isBypassedWithNullTypeShouldThrowException () {
515+ try {
516+ TriggerActionFlow .isBypassed ((System .Type ) null );
517+ } catch (Exception e ) {
518+ myException = e ;
519+ }
520+
521+ System .Assert .areNotEqual (null , myException , EXCEPTION_SHOULD_BE_THROWN );
522+ System .Assert .areEqual (
523+ true ,
524+ myException .getMessage ()
525+ .contains (TriggerActionFlow .TYPE_MUST_BE_PROVIDED_ERROR ),
470526 EXCEPTION_SHOULD_HAVE_THE_CORRECT_MESSAGE
471527 );
472528 }
0 commit comments