@@ -973,5 +973,63 @@ public virtual with sharing class fflib_SObjectDomain
973
973
{
974
974
return new TestSObjectOnValidateBehaviour (sObjectList );
975
975
}
976
- }
977
- }
976
+ }
977
+
978
+ /**
979
+ * Test domain class (ideally this would be in the test class, however Type.newInstance does not see such classes)
980
+ **/
981
+ public with sharing class TestSObjectDisableBehaviour
982
+ extends fflib_SObjectDomain
983
+ {
984
+ public TestSObjectDisableBehaviour (List <Opportunity > sObjectList )
985
+ {
986
+ super (sObjectList );
987
+ }
988
+
989
+ public override void onAfterInsert () {
990
+ // Throw exception to give the test somethign to assert on
991
+ throw new DomainException (' onAfterInsert called' );
992
+ }
993
+
994
+ public override void onBeforeInsert () {
995
+ // Throw exception to give the test somethign to assert on
996
+ throw new DomainException (' onBeforeInsert called' );
997
+ }
998
+
999
+ public override void onAfterUpdate (map <id , SObject > existing ) {
1000
+ // Throw exception to give the test somethign to assert on
1001
+ throw new DomainException (' onAfterUpdate called' );
1002
+ }
1003
+
1004
+ public override void onBeforeUpdate (map <id , SObject > existing ) {
1005
+ // Throw exception to give the test somethign to assert on
1006
+ throw new DomainException (' onBeforeUpdate called' );
1007
+ }
1008
+
1009
+ public override void onAfterDelete () {
1010
+ // Throw exception to give the test somethign to assert on
1011
+ throw new DomainException (' onAfterDelete called' );
1012
+ }
1013
+
1014
+ public override void onBeforeDelete () {
1015
+ // Throw exception to give the test somethign to assert on
1016
+ throw new DomainException (' onBeforeDelete called' );
1017
+ }
1018
+
1019
+ public override void onAfterUndelete () {
1020
+ // Throw exception to give the test somethign to assert on
1021
+ throw new DomainException (' onAfterUndelete called' );
1022
+ }
1023
+ }
1024
+
1025
+ /**
1026
+ * Typically an inner class to the domain class, supported here for test purposes
1027
+ **/
1028
+ public class TestSObjectDisableBehaviourConstructor implements fflib_SObjectDomain .IConstructable
1029
+ {
1030
+ public fflib_SObjectDomain construct (List <SObject > sObjectList )
1031
+ {
1032
+ return new TestSObjectDisableBehaviour (sObjectList );
1033
+ }
1034
+ }
1035
+ }
0 commit comments