You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
When creating an AccountsServiceTest (similar to the OpportunitiesServiceTest in the sample), I have the following error:
The test method:
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.
The text was updated successfully, but these errors were encountered: