mattaddy / SObjectFabricator

An SObject fabrication API to reduce database interactions and dependencies on triggers in Apex unit tests.
Other
89 stars 14 forks source link

Can't create a fabricated SObject for the type Quote #10

Closed renatoliveira closed 6 years ago

renatoliveira commented 6 years ago

I'm trying to write a test method for a method that reads a quote line item and it reads data from the account related to the opportunity, as the following relationship:

account - opportunity - quote - quotelineitem

Then I have those lines:

sfab_FabricatedSObject fabricatedAccount = new sfab_FabricatedSObject(Account.class)
    .setField(Account.MinimumDeliveryTime__c, 8);
sfab_FabricatedSObject fabricatedOpportunity = new sfab_FabricatedSObject(Opportunity.class);
sfab_FabricatedSObject fabricatedQuote = new sfab_FabricatedSObject(Quote.class);
sfab_FabricatedSObject fabricatedQuoteLineItem = new sfab_FabricatedSObject(QuoteLineItem.class);

But I can't save the class, because salesforce is interpreting Quote.class incorrectly. I'm getting Invalid field class for SObject Quote.

Is there a workaround?

renatoliveira commented 6 years ago

Oooops, nevermind this issue. The class had a variable named quote, which resulted in the compile error. Using Schema.Quote.class worked as replacement.