Giter VIP home page Giter VIP logo

fflib-apex-common-samplecode's People

Contributors

afawcett avatar afawcettffdc avatar daveespo avatar dbtavernerffdc avatar dfruddffdc avatar imjohnmdaniel avatar jaertgeerts avatar kjonescertinia avatar loganm avatar mthobisi avatar peterlin888 avatar wimvelzeboer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fflib-apex-common-samplecode's Issues

Error Message "Dependent class is invalid and needs recompilation" when deploying in blank org

The fflib framework is installed, but when I try to install the sample app, I get the following error message:

Deployment Complete
Failures:
classes/Accounts.cls(53,5):Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/AccountsSelector.cls(53,5):Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/Application.cls(53,5):Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/OpportunitiesServiceTestIntegration.cls(53,5):Dependent class is invalid and needs recompilation:
Class OpportunitiesService : Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/OpportunitiesTest.cls(53,5):Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/OpportunitiesServiceTest.cls(53,5):Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/OpportunityApplyDiscountController.cls(53,5):Dependent class is invalid and needs recompilation:
Class OpportunitiesService : Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/OpportunityApplyDiscountControllerTest.cls(53,5):Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/OpportunityApplyDiscountControllerTestI.cls(53,5):Dependent class is invalid and needs recompilation:
Class OpportunityApplyDiscountController : Dependent class is invalid and needs recompilation:
Class OpportunitiesService : Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/OpportunityConsoleController.cls(53,5):Dependent class is invalid and needs recompilation:
Class OpportunitiesService : Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/InvoicingService.cls(53,5):Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/InvoicingServiceImpl.cls(53,5):Dependent class is invalid and needs recompilation:
Class InvoicingService : Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/InvoicingServiceTest.cls(53,5):Dependent class is invalid and needs recompilation:
Class InvoicingService : Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/Opportunities.cls(53,5):Dependent class is invalid and needs recompilation:
Class InvoicingService : Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/OpportunitiesResource.cls(53,5):Dependent class is invalid and needs recompilation:
Class OpportunitiesService : Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/OpportunitiesSelector.cls(53,5):Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/OpportunitiesService.cls(53,5):Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/OpportunitiesServiceImpl.cls(53,5):Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/OpportunityCreateInvoiceController.cls(53,5):Dependent class is invalid and needs recompilation:
Class OpportunitiesService : Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/OpportunityInvoicingController.cls(53,5):Dependent class is invalid and needs recompilation:
Class OpportunitiesService : Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/OpportunityLineItems.cls(53,5):Dependent class is invalid and needs recompilation:
Class Opportunities : Dependent class is invalid and needs recompilation:
Class InvoicingService : Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/OpportunityLineItemsSelector.cls(63,22):Method does not exist or incorrect signature: void getFieldListString() from the type OpportunityLineItemsSelector
classes/PricebookEntriesSelector.cls(53,5):Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/CreateInvoicesJob.cls(53,5):Dependent class is invalid and needs recompilation:
Class OpportunitiesService : Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
classes/DeveloperWorkItemsTest.cls(53,5):Dependent class is invalid and needs recompilation:
Class Application : Dependent class is invalid and needs recompilation:
Class OpportunitiesServiceImpl : Dependent class is invalid and needs recompilation:
Class OpportunitiesSelector : Dependent class is invalid and needs recompilation:
Class PricebookEntriesSelector : Method does not exist or incorrect signature: void getFieldListString() from the type PricebookEntriesSelector
triggers/OpportunitiesTrigger.trigger(31,37):Invalid type: Opportunities
triggers/OpportunityLineItemsTrigger.trigger(31,37):Invalid type: OpportunityLineItems
pages/opportunityapplydiscount.page(opportunityapplydiscount):Apex class 'OpportunityApplyDiscountController' does not exist
pages/opportunityapplydiscounts.page(opportunityapplydiscounts):Apex class 'OpportunityApplyDiscountController' does not exist
pages/opportunitycreateinvoice.page(opportunitycreateinvoice):Apex class 'OpportunityCreateInvoiceController' does not exist
pages/opportunitycreateinvoices.page(opportunitycreateinvoices):Apex class 'OpportunityCreateInvoiceController' does not exist
pages/opportunityinvoicing.page(opportunityinvoicing):Apex class 'OpportunityInvoicingController' does not exist

Interplay between onValidate and onAfterInsert/Update

By way of example, I've excerpted from the samplecode Domain Opportunities.cls.

Is this by design?

If onValidate() places an error via opp.Type.addError(error(msg,opp,fieldToken)) on some record in the batch, say record 22, then when the onAfterInsert comes along, the Accounts related to all opportunities in the batch including record 22, will go through the update via uow.commitWork().

This seems flawed, - if there is a onValidate() handler error, the affected records should be excluded in the sample code from inclusion in accountIds.

It would be nice if there were an easy way to communicate the erroneous records between handlers in the framework, but the errors(...) method only saves the errors in a list, not a map keyed by the record.ID.

I could, I guess, introduce my own error(...) into a subclass of fflib_SObjectDomain that in turn is extended by Opportunities.cls. My version of error(..) would capture the errorneous record id in a map for inspection by the onAfterInsert and onAfterUpdate handlers.

But I'm wondering if I'm missing something provided by the Domain layer that would obviate this seemingly basic feature.

    public override void onValidate(Map<Id,SObject> existingRecords)
    {
        // Validate changes to Opportunities
        for(Opportunity opp : (List<Opportunity>) Records)
        {
            Opportunity existingOpp = (Opportunity) existingRecords.get(opp.Id);
            if(opp.Type != existingOpp.Type)
            {
                opp.Type.addError( error('You cannot change the Opportunity type once it has been created.', opp, Opportunity.Type) );
            }
        }
    }

    public override void onAfterInsert()
    {
        // Related Accounts
        List<Id> accountIds = new List<Id>();
        for(Opportunity opp : (List<Opportunity>) Records)
            if(opp.AccountId!=null) // ?! what about excluding the opps that had their type changed ?
                accountIds.add(opp.AccountId);

        // Update last Opportunity activity on the related Accounts (via the Accounts domain class)
        fflib_SObjectUnitOfWork uow = new fflib_SObjectUnitOfWork(new Schema.SObjectType[] { Account.SObjectType }); 
        Accounts accounts = new Accounts([select Id, Name from Account where id in :accountIds]);
        accounts.updateOpportunityActivity(uow);
        uow.commitWork();               
    }

Example of using domains of arbitrary ApexTypes

When the domain class was split into triggerHandler and domain classes, the PR #300 author @wimvelzeboer mentioned that domains could now be arbitrary ApexTypes

It would be nice to see this sample repo extended to show such an example. This would include:

  • Factory construction in the Application.cls
  • ApexMocks support (enabled by Factory construction)

As I understand it, such domains of arbitrary ApexTypes extend fflib_Objects but I believe to implement factories and mocking support, some changes are needed in fflib_Application.cls to support something other than SObjectTypes as keys to the constructor class.

Test can't be deployed - Method does not exist or incorrect signature: void selectSObjectsById

I followed this example to write my tests and it is not working.

image

this is the Test I can't deploy

static void  itShouldUpdateDocumentSigningRequestsStatusWhenGivenIds() {
        
		List<DocumentSigningRequest__c> documentSigningRequests = new List<DocumentSigningRequest__c>
		{
				new DocumentSigningRequest__c(Status__c = 'New', Id = fflib_IDGenerator.generate(Schema.DocumentSigningRequest__c.SObjectType)),
				new DocumentSigningRequest__c(Status__c = 'New', Id = fflib_IDGenerator.generate(Schema.DocumentSigningRequest__c.SObjectType)),
				new DocumentSigningRequest__c(Status__c = 'New', Id = fflib_IDGenerator.generate(Schema.DocumentSigningRequest__c.SObjectType))
		};

        Set<Id> documentSigningRequestIds = new Map<Id, SObject>(documentSigningRequests).keySet();

        fflib_ApexMocks mocks = new fflib_ApexMocks();
		fflib_ISObjectUnitOfWork unitOfWorkMock = new fflib_SObjectMocks.SObjectUnitOfWork(mocks);
        DSP_IDocumentSigningRequestsSelector selectorMock = (DSP_IDocumentSigningRequestsSelector) mocks.mock(DSP_DocumentSigningRequestsSelector.class);
        DSP_IDocumentSigningRequests domainMock = (DSP_IDocumentSigningRequests) mocks.mock(DSP_DocumentSigningRequests.class);

        mocks.startStubbing();
        mocks.when(selectorMock.sObjectType()).thenReturn(Schema.Account.SObjectType);
		mocks.when(selectorMock.selectSObjectsById(documentSigningRequestIds)).thenReturn(documentSigningRequests);
		mocks.when(domainMock.sObjectType()).thenReturn(Schema.DocumentSigningRequest__c.SObjectType);
		mocks.when(domainMock.getDocumentSigningRequests()).thenReturn(documentSigningRequests);
		mocks.stopStubbing();

        DSP_Application.UnitOfWork.setMock(unitOfWorkMock);
		DSP_Application.Domain.setMock(domainMock);
        DSP_Application.Selector.setMock(selectorMock);

        Test.startTest();
        new DSP_DocumentSigningRequestsServiceImpl().updateStatus(documentSigningRequestIds, 'Publish');
        Test.stopTest();

        ((DSP_IDocumentSigningRequestsSelector) mocks.verify(selectorMock)).selectSObjectsById(documentSigningRequests);
        ((DSP_IDocumentSigningRequests) mocks.verify(domainMock)).setStatus();
        ((fflib_ISObjectUnitOfWork)	mocks.verify(unitOfWorkMock)).registerDirty(documentSigningRequests);
		((fflib_ISObjectUnitOfWork)	mocks.verify(unitOfWorkMock)).commitWork();
    }

This is DSP_IDocumentSigningRequests interface

public interface DSP_IDocumentSigningRequests extends fflib_ISObjectDomain {
    void setBody(Map<Id, String> bodyMappedById);
    void setStatus(String status);
    Set<Id> getParentIds();
    Set<Id> getRecordsIds();
    List<DocumentSigningRequest__c> getDocumentSigningRequests();
    Map<Id, DocumentSigningRequest__c> getRecordsMap();
}

This is DSP_IDocumentSigningRequestsSelector interface

public interface DSP_IDocumentSigningRequestsSelector extends fflib_ISObjectSelector {
    List<DocumentSigningRequest__c> selectAllWithSignersById(Set<Id> ids);

    Database.QueryLocator selectAllNewQueryLocator();
}

In your example, your IAccountSelector interface does not have selectSObjectsById() declared and yet it seems to work. How did you do it? My interface is also extending fflib_ISObjectSelector and I can't deploy because of that error.

And I don't know what is happending for setStatus(). It is declared in my interface, and I have mocked it. So what is wrong?

Create Releases and add docs when introducing Breaking changes

I noticed 7 months ago changes were made to separate the Domain into two entities, one to work as the trigger handler and the other to basically manipulate data. This is a breaking change because class and interface names were changed. So it would be nice to have a Doc showing before and after, when these type of changes happen before merging them. Also, it would be nice if you could tag at least these Major changes, so people are aware of them.
Because my project has an older version of FFLIB and the sample code is using the latest, when I wrote my app following the sample I got some errors while deploying. Because of these errors, I spent around an hour reading the sample code changes to understand what I should do to enable my app to work with the old fflib.

Missing methods in IOpportunitiesSelector

The IOpportunitiesSelector does not cover the following methods in OpportunitiesSelector:

  • List selectById(Set idSet)
  • List selectOpportunityInfo(Set idSet)
  • Database.QueryLocator queryLocatorReadyToInvoice()

Mocks.cls using deprecated mockNonVoidMethod & mockVoidMethod method

Mocks: line 18, column 31: Method does not exist or incorrect signature: [fflib_ApexMocks].mockNonVoidMethod(Mocks.OpportunitiesSelector, String, List)

Needs updating to the more recent version of the fflib_ApexMocks:
requiring following parameters:
public Object mockNonVoidMethod(Object mockInstance, String methodName, List<Type> methodArgTypes, List<Object> methodArgValues)

  • @param mockInstance The mock object instance.
  • @param methodName The method for which to prepare a return value.
  • @param methodArgTypes The method argument types for which to prepare a return value.
  • @param methodArgValues The method argument values for which to prepare a return value.

While only receiving the deprecated version:
public Object mockNonVoidMethod(Object mockInstance, String methodName, Object methodArg)

  • @param mockInstance The mock object instance.
  • @param methodName The method for which to prepare a return value.
  • @param methodArg The method argument for which to prepare a return value.

This is also causing the deployment of this repository to fail.

Alternative instantiation for Services

Hi @ImJohnMDaniel

In these examples I see that thee are a number of different ways to create new instances for the several classes.
For domains there is a static method newInstance on the implementation class Accounts
(e.g. static IAccounts newInstance(Set<Id> recordIdSet)).
The service classes have their own separate class (e.g. OpportunitiesService) with a static version of all the method signatures of its Interface.

There are also many developers I work with, who find this a bit cumbersome, a too big overhead and duplication of method signatures.

Would it be an idea to do something similar as we do with the domain?
How would you feel about calling service methods not via:
OpportunitiesService.applyDiscounts(ids, 10);
but via a lazy loading static property on the domain:
Opportunities.Service.applyDiscounts(ids, 10);
or exactly the same as the domain:
OpportunitiesService.newInstance().applyDiscounts(Ids, 10);

Have you had any discussions about this approach in the past?
It would be nice if we can avoid that class with statics..

CC: @daveespo, @afawcett, @stohn777

fflib_SObjectSelectorTest - 3 Tests fail

Hi,
when I run the tests 3 test in fflib_SObjectSelectorTest fail:
bildschirmfoto 2014-09-30 um 13 54 42

In all 3 cases the sequence of the expected fields is not like the returned ones:
bildschirmfoto 2014-09-30 um 13 57 56

Is there anything I need to change or is it a typo in the asserts?

Thanks & Regards
Oliver

Error occurs during ant migration

All Component Failures:

  1. flows/CreateCustomer.flow -- Error: Required field is missing: actionType (line 3, column 18)
  2. flows/CreatePolicy.flow -- Error: Required field is missing: actionType (line 3, column 18)
  3. flows/CustomerPolicy.flow -- Error: Required field is missing: actionType (line 3, column 18)
  4. flowDefinitions/CreateCustomer.flowDefinition -- Error: You can't create a flow definition directly through the API. A flow definition is created automatically when you create a new flow version.
  5. flowDefinitions/CreatePolicy.flowDefinition -- Error: You can't create a flow definition directly through the API. A flow definition is created automatically when you create a new flow version.
  6. flowDefinitions/CustomerPolicy.flowDefinition -- Error: You can't create a flow definition directly through the API. A flow definition is created automatically when you create a new flow version.
  7. classes/TestDataFactoryTest.cls -- Error: Page OrderDocument does not exist
  8. classes/UIAmbassadorController.cls -- Error: Page OrderDocument does not exist
  9. classes/UIAmbassadorControllerTest.cls -- Error: Page OrderDocument does not exist
  10. classes/UIAttachmentHandler.cls -- Error: Page OrderDocument does not exist
  11. classes/UIHomeController.cls -- Error: Page OrderDocument does not exist
  12. classes/UIHomeControllerTest.cls -- Error: Page OrderDocument does not exist
  13. classes/UIHomeLogin.cls -- Error: Page OrderDocument does not exist
  14. classes/UIHomeLoginTest.cls -- Error: Page OrderDocument does not exist
  15. classes/UINxtExtension.cls -- Error: Page OrderDocument does not exist
  16. classes/UINxtExtensionTest.cls -- Error: Page OrderDocument does not exist
  17. classes/UIRegisterExt.cls -- Error: Page OrderDocument does not exist
  18. classes/UIRegisterExtTest.cls -- Error: Page OrderDocument does not exist
  19. classes/UIResponse.cls -- Error: Page OrderDocument does not exist
  20. classes/UIResponseTest.cls -- Error: Page OrderDocument does not exist
  21. classes/UIResultWrapper.cls -- Error: Page OrderDocument does not exist
  22. classes/AddressUtility.cls -- Error: Page OrderDocument does not exist
  23. classes/AddressUtilityTest.cls -- Error: Page OrderDocument does not exist
  24. classes/Approved.cls -- Error: Page OrderDocument does not exist
  25. classes/AsyncScswAddresswareCom.cls -- Error: Page OrderDocument does not exist
  26. classes/NeoDigitalWrapperTest.cls -- Error: Page OrderDocument does not exist
  27. classes/OKKPolicyController.cls -- Error: Page OrderDocument does not exist
  28. classes/OKKPolicyControllerTest.cls -- Error: Page OrderDocument does not exist
  29. classes/ObjectBeforeTriggerTest.cls -- Error: Page OrderDocument does not exist
  30. classes/ObjectHandler.cls -- Error: Page OrderDocument does not exist
  31. classes/ObjectHandlerTest.cls -- Error: Page OrderDocument does not exist
  32. classes/ObjectUtility.cls -- Error: Page OrderDocument does not exist
  33. classes/ObjectUtilityTest.cls -- Error: Page OrderDocument does not exist
  34. classes/ObjectWrapper.cls -- Error: Page OrderDocument does not exist
  35. classes/ObjectWrapperTest.cls -- Error: Page OrderDocument does not exist
  36. classes/OnDemandRenewalScheduler.cls -- Error: Page OrderDocument does not exist
  37. classes/PDFRendering.cls -- Error: Page OrderDocument does not exist
  38. classes/PDFRenderingTest.cls -- Error: Page OrderDocument does not exist
  39. classes/PaymentProcessScheduler.cls -- Error: Page OrderDocument does not exist
  40. classes/PaymentUtility.cls -- Error: Page OrderDocument does not exist
  41. classes/PaymentUtilitytest.cls -- Error: Page OrderDocument does not exist
  42. classes/PolicyAfterTriggerTest.cls -- Error: Page OrderDocument does not exist
  43. classes/PolicyUtility.cls -- Error: Page OrderDocument does not exist
  44. classes/PolicyUtilityTest.cls -- Error: Page OrderDocument does not exist
  45. classes/PremiumCalculation.cls -- Error: Page OrderDocument does not exist
  46. classes/PremiumCalculationTest.cls -- Error: Page OrderDocument does not exist
  47. classes/PremiumWrapper.cls -- Error: Page OrderDocument does not exist
  48. classes/PremiumWrapperTest.cls -- Error: Page OrderDocument does not exist
  49. classes/Product2Utility.cls -- Error: Page OrderDocument does not exist
  50. classes/Product2UtilityTest.cls -- Error: Page OrderDocument does not exist
  51. classes/Product2Wrapper.cls -- Error: Page OrderDocument does not exist
  52. classes/Product2WrapperTest.cls -- Error: Page OrderDocument does not exist
  53. classes/ProductBeforeTriggerTest.cls -- Error: Page OrderDocument does not exist
  54. classes/AttachmentUtility.cls -- Error: Page OrderDocument does not exist
  55. classes/AttachmentUtilityTest.cls -- Error: Page OrderDocument does not exist
  56. classes/BatchEventPolicy.cls -- Error: Page OrderDocument does not exist
  57. classes/BatchEventPolicyTest.cls -- Error: Page OrderDocument does not exist
  58. classes/BatchEventRemainder.cls -- Error: Page OrderDocument does not exist
  59. classes/BatchFlatrateRenewal.cls -- Error: Page OrderDocument does not exist
  60. classes/BatchInsuredValueUpdate.cls -- Error: Page OrderDocument does not exist
  61. classes/BatchInvoiceProcess.cls -- Error: Page OrderDocument does not exist
  62. classes/BatchOnDemandRenewal.cls -- Error: Page OrderDocument does not exist
  63. classes/BatchPaymentFailure.cls -- Error: Page OrderDocument does not exist
  64. classes/BatchPaymentProcess.cls -- Error: Page OrderDocument does not exist
  65. classes/BatchPolicyRenewal.cls -- Error: Page OrderDocument does not exist
  66. classes/BatchWelcomeEmail.cls -- Error: Page OrderDocument does not exist
  67. classes/ClaimAfterTriggerTest.cls -- Error: Page OrderDocument does not exist
  68. classes/ClaimHandler.cls -- Error: Page OrderDocument does not exist
  69. classes/ClaimHandlerTest.cls -- Error: Page OrderDocument does not exist
  70. classes/ClaimSettle.cls -- Error: Page OrderDocument does not exist
  71. classes/ClaimUtility.cls -- Error: Page OrderDocument does not exist
  72. classes/ClaimUtilityTest.cls -- Error: Page OrderDocument does not exist
  73. classes/ComplaintWrapper.cls -- Error: Page OrderDocument does not exist
  74. classes/ComplaintWrappertest.cls -- Error: Page OrderDocument does not exist
  75. classes/Constants.cls -- Error: Page OrderDocument does not exist
  76. classes/ConstantsTest.cls -- Error: Page OrderDocument does not exist
  77. classes/ContactBeforeTriggerTest.cls -- Error: Page OrderDocument does not exist
  78. classes/DataHandler.cls -- Error: Page OrderDocument does not exist
  79. classes/DateUtility.cls -- Error: Page OrderDocument does not exist
  80. classes/DateUtilityTest.cls -- Error: Page OrderDocument does not exist
  81. classes/DraftApprove.cls -- Error: Page OrderDocument does not exist
  82. classes/EmailUtility.cls -- Error: Page OrderDocument does not exist
  83. classes/ProfileHandlerTest.cls -- Error: Page OrderDocument does not exist
  84. classes/ProfileWrapper.cls -- Error: Page OrderDocument does not exist
  85. classes/ProfileWrappertest.cls -- Error: Page OrderDocument does not exist
  86. classes/RVGPolicyController.cls -- Error: Page OrderDocument does not exist
  87. classes/RVGPolicyControllerTest.cls -- Error: Page OrderDocument does not exist
  88. classes/RegistrationController.cls -- Error: Page OrderDocument does not exist
  89. classes/RucksackAfterTriggerTest.cls -- Error: Page OrderDocument does not exist
  90. classes/RucksackHandler.cls -- Error: Page OrderDocument does not exist
  91. classes/RucksackHandlerTest.cls -- Error: Page OrderDocument does not exist
  92. classes/ProfileHandler.cls -- Error: Page OrderDocument does not exist
  93. classes/RucksackWrapper.cls -- Error: Page OrderDocument does not exist
  94. classes/RucksackWrapperTest.cls -- Error: Page OrderDocument does not exist
  95. classes/SaferpayWrapper.cls -- Error: Page OrderDocument does not exist
  96. classes/SaferpayWrapperTest.cls -- Error: Page OrderDocument does not exist
  97. classes/SearchUtility.cls -- Error: Page OrderDocument does not exist
  98. classes/SearchUtilityTest.cls -- Error: Page OrderDocument does not exist
  99. classes/SortUtility.cls -- Error: Page OrderDocument does not exist
  100. classes/SortUtilitytest.cls -- Error: Page OrderDocument does not exist
  101. classes/TestDataFactory.cls -- Error: Page OrderDocument does not exist
  102. classes/UIResultWrapperTest.cls -- Error: Page OrderDocument does not exist
  103. classes/UpdateFlag.cls -- Error: Page OrderDocument does not exist
  104. classes/UserPolicy.cls -- Error: Page OrderDocument does not exist
  105. classes/UserPolicyTest.cls -- Error: Page OrderDocument does not exist
  106. classes/Utility.cls -- Error: Page OrderDocument does not exist
  107. classes/UtilityTest.cls -- Error: Page OrderDocument does not exist
  108. classes/VoucherContactBeforeTriggerTest.cls -- Error: Page OrderDocument does not exist
  109. classes/WebServiceMockImpl.cls -- Error: Page OrderDocument does not exist
  110. classes/WelcomeEmailScheduler.cls -- Error: Page OrderDocument does not exist
  111. triggers/ClaimAfterTrigger.trigger -- Error: Variable does not exist: ClaimUtility (line 15, column 13)
  112. triggers/EventAfterTrigger.trigger -- Error: Variable does not exist: LingsApp (line 10, column 5)
  113. triggers/InvoiceAfterTrigger.trigger -- Error: Variable does not exist: ClaimUtility (line 15, column 9)
  114. triggers/ObjectBeforeTrigger.trigger -- Error: Variable does not exist: LingsApp (line 7, column 9)
  115. triggers/PolicyAfterTrigger.trigger -- Error: Variable does not exist: Constants (line 12, column 62)
  116. triggers/ProductBeforeTrigger.trigger -- Error: Variable does not exist: LingsApp (line 6, column 5)
  117. triggers/RucksackAfterTrigger.trigger -- Error: Variable does not exist: MobileAppUtility (line 13, column 4)
  118. triggers/LingsObjectAfterTrigger.trigger -- Error: Variable does not exist: LingsApp (line 7, column 5)
  119. classes/EmailUtilitytest.cls -- Error: Page OrderDocument does not exist
  120. classes/EventAfterTriggerTest.cls -- Error: Page OrderDocument does not exist
  121. classes/EventHandler.cls -- Error: Page OrderDocument does not exist
  122. classes/EventHandlerTest.cls -- Error: Page OrderDocument does not exist
  123. classes/EventPolicyScheduler.cls -- Error: Page OrderDocument does not exist
  124. classes/EventRemainderScheduler.cls -- Error: Page OrderDocument does not exist
  125. classes/EventUtility.cls -- Error: Page OrderDocument does not exist
  126. classes/EventUtilityTest.cls -- Error: Page OrderDocument does not exist
  127. classes/EventWrapper.cls -- Error: Page OrderDocument does not exist
  128. classes/EventWrapperTestClass.cls -- Error: Page OrderDocument does not exist
  129. classes/ExceptionUtility.cls -- Error: Page OrderDocument does not exist
  130. classes/ExceptionUtilityTest.cls -- Error: Page OrderDocument does not exist
  131. classes/ForgotPasswordController.cls -- Error: Page OrderDocument does not exist
  132. classes/ForgotPasswordControllerTest.cls -- Error: Page OrderDocument does not exist
  133. classes/InvoiceAfterTriggerTest.cls -- Error: Page OrderDocument does not exist
  134. classes/InvoiceController.cls -- Error: Page OrderDocument does not exist
  135. classes/InvoiceProcessScheduler.cls -- Error: Page OrderDocument does not exist
  136. classes/LingsApp.cls -- Error: Page OrderDocument does not exist
  137. classes/LingsApptest.cls -- Error: Page OrderDocument does not exist
  138. classes/LingsCalloutMock.cls -- Error: Page OrderDocument does not exist
  139. classes/LingsCalloutMock1.cls -- Error: Page OrderDocument does not exist
  140. classes/LingsObjectAfterTriggerTest.cls -- Error: Page OrderDocument does not exist
  141. classes/LinkClaimAttachmentTest.cls -- Error: Page OrderDocument does not exist
  142. classes/MobileAppUtility.cls -- Error: Page OrderDocument does not exist
  143. classes/MobileAppUtilityTest.cls -- Error: Page OrderDocument does not exist
  144. classes/MobileUtility.cls -- Error: Page OrderDocument does not exist
  145. classes/MobileUtilityTest.cls -- Error: Page OrderDocument does not exist
  146. classes/MyProfilePageController.cls -- Error: Page OrderDocument does not exist
  147. classes/MyProfilePageControllerTest.cls -- Error: Page OrderDocument does not exist
  148. classes/NeoDigitalCreateClaimTest.cls -- Error: Page OrderDocument does not exist
  149. classes/NeoDigitalCreateClaim.cls -- Error: Page OrderDocument does not exist
  150. classes/NeoDigitalCreateCustomer.cls -- Error: Page OrderDocument does not exist
  151. classes/NeoDigitalCreateCustomerController.cls -- Error: Page OrderDocument does not exist
  152. classes/NeoDigitalCreateCustomerTest.cls -- Error: Page OrderDocument does not exist
  153. classes/NeoDigitalCreatePolicy.cls -- Error: Page OrderDocument does not exist
  154. classes/NeoDigitalCreatePolicytest.cls -- Error: Page OrderDocument does not exist
  155. classes/NeoDigitalPolicyRequestWrapper.cls -- Error: Page OrderDocument does not exist
  156. classes/NeoDigitalRequestWrapper.cls -- Error: Page OrderDocument does not exist
  157. classes/NeoDigitalResponseWrapper.cls -- Error: Page OrderDocument does not exist
  158. classes/NeoDigitalWrapper.cls -- Error: Page OrderDocument does not exist
  159. classes/NeoDigitalWrapperClaim.cls -- Error: Page OrderDocument does not exist
  160. classes/NeoDigitalWrapperCustomer.cls -- Error: Page OrderDocument does not exist
  161. classes/NeoDigitalWrapperPolicy.cls -- Error: Page OrderDocument does not exist
  162. aura/ApproveProduct/ApproveProduct.cmp -- Error: Invalid definition for Approved: ApexService.getType() return null with currentNamespace: c, namespace: null, name: Approved
  163. pages/Beratungsprotokoll.page -- Error: Apex class 'BeratungsprotokollExt' does not exist
  164. pages/InvoicePage.page -- Error: Apex class 'InvoiceController' does not exist
  165. pages/NeoDigitalCustomer.page -- Error: Apex class 'NeoDigitalCreateCustomerController' does not exist
  166. pages/OKKPolicy.page -- Error: Apex class 'OKKPolicyController' does not exist
  167. pages/Policy.page -- Error: Apex class 'UserPolicy' does not exist
  168. pages/RVGPolicy.page -- Error: Apex class 'RVGPolicyController' does not exist
  169. pages/RegistrationPage.page -- Error: Apex class 'RegistrationController' does not exist
  170. pages/UIHome.page -- Error: Apex class 'UIHomeController' does not exist
  171. flows/Claim_Updates.flow -- Error: myRule_1_A2 (Action) - We can't find an action with the name and action type that you specified.

Ambiguous method signature: void setMock

When creating an AccountsServiceTest (similar to the OpportunitiesServiceTest in the sample), I have the following error:

Ambiguous method signature: void setMock.

The test method:

@IsTest
	private static void testSync(){
        // Create mocks
		fflib_ApexMocks mocks = new fflib_ApexMocks();
		
		fflib_ISObjectUnitOfWork uowMock = (fflib_ISObjectUnitOfWork) mocks.mock(fflib_ISObjectUnitOfWork.class);
		IAccounts domainMock = (IAccounts) mocks.mock(IAccounts.class);
		IAccountsSelector selectorMock = (IAccountsSelector) mocks.mock(IAccountsSelector.class);


		// Given
		mocks.startStubbing();
		List<Account> testAccsList = new List<Account> { 
			new Account(
				Id = fflib_IDGenerator.generate(Account.SObjectType),
				Name = 'Clinic Test',
                RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get(Label.RecordType_BusinessAccount).getRecordTypeId(),
                Type = 'IVF Clinic', 
                Subsidiary__c = 'SPAIN', 
                Category__c = 'A', 
                BillingCountry = 'Spain', 
                SRMExternalId__c = '2222')};
		Set<Id> testAccSet = new Map<Id, Account>(testAccsList).keySet();
		mocks.when(domainMock.sObjectType()).thenReturn(Account.SObjectType);
		mocks.when(selectorMock.sObjectType()).thenReturn(Account.SObjectType);
		mocks.when(selectorMock.selectById(testAccSet)).thenReturn(testAccsList);
		mocks.stopStubbing();
		Application.UnitOfWork.setMock(uowMock);
		Application.Domain.setMock(domainMock);
		Application.Selector.setMock(selectorMock);

		// When
		AccountsService.sync(testAccSet);

		// Then
		((IAccounts) 
			mocks.verify(domainMock)).sync(uowMock);
		((fflib_ISObjectUnitOfWork) 
			mocks.verify(uowMock, 1)).commitWork();
    }

My IAccounts is like this:
public interface IAccounts extends fflib_ISObjectDomain { void sync(fflib_ISObjectUnitOfWork uow); }

In order to patch it, I added a new setMock function that receives an IAccounts as the parameter, but it is obviously a patch.
Can anyone please tell me why am I getting this error?

Thanks in advance.

Example of before insert trigger

Because records in a before insert/before update trigger should not be updated, it would be good to have an example of how to deal with them. The sample code only contains examples of on after trigger events that pair nicely with UoW and other domains.

Deployment Fails OpportunitiesTest

When deploying the sample code to an org using the deploy tool, there is the following deployment error:

deploy/classes/OpportunitiesTest.cls(38,38):Invalid type: fflib_SObjectMocks.SObjectUnitOfWork

I believe this is because the fflib_SObjectMocks pattern has been replaced, and line 38 on the test class should be:

fflib_SObjectUnitOfWork uowMock =
(fflib_SObjectUnitOfWork) mocks.mock(fflib_SObjectUnitOfWork.class);

Hello World Tutorial for APEX Mocks

I am working on a project in which we need to test an APEX REST Service in such a way that no actual data is created in Salesforce during the testcases execution. I am new to APEX Development.

Searching on the web took me to fflib-apex-mocks library which seems to serve the purpose of avoiding the usage of actual test data inserted in the database for testcases execution. I have installed fflib-apex-mocks and fflib-apex-common in my sandbox environment.

So far, I am not able to find out a step-by-step guide as what I need to do if I want to test my existing Salesforce Objects at a unit level and how can I test my APEX Rest Service? From looking at the fflib-apex-common-samplecode it seems that I need to define classes for my Salesforce objects, I am not sure if I am getting this right.

At a higher-level, below are my questions at a higher-level:

  • I have a Student__c Object already defined in Salesforce, it has some triggers for insert and update which has checks for various fields and I want these triggers to fire when I try an insert or update for the mock object. I want to develop testcases for that, what do I need to do? How do I start?
  • I have an APEX Rest Service which gets a collection of Teacher__c objects converted to JSON based on the id of a Student__c object provided to it as a query parameter. I have previously developed testcases for APEX Rest Service but that didn't involved actual objects usage but my current scenario is different as it involves usage of actual objects.

Can someone please help me out in getting started?

Deployment Issue

I am trying to deploy the sample code to a brand new org (the deployment of mok and common went fine) and i have set the version to 37.0 Getting the following error

C:\apexsharp\AdvanceSalesForce\src\applications\standard__Content.app
Error:(1, 1) Property 'formFactors' not valid in version 37.0
C:\apexsharp\AdvanceSalesForce\src\applications\standard__Community.app
Error:(1, 1) Property 'formFactors' not valid in version 37.0
C:\apexsharp\AdvanceSalesForce\src\applications\standard__LightningSalesConsole.app
Error:(1, 1) Property 'formFactors' not valid in version 37.0
C:\apexsharp\AdvanceSalesForce\src\applications\standard__LightningService.app
Error:(1, 1) Property 'formFactors' not valid in version 37.0
C:\apexsharp\AdvanceSalesForce\src\applications\standard__Marketing.app
Error:(1, 1) Property 'formFactors' not valid in version 37.0
C:\apexsharp\AdvanceSalesForce\src\applications\standard__Service.app
Error:(1, 1) Property 'formFactors' not valid in version 37.0
C:\apexsharp\AdvanceSalesForce\src\applications\standard__ServiceConsole.app
Error:(1, 1) Property 'enableListViewHover' not valid in version 37.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.