As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [stubapi]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
43 views

How can we write a test class for class containing the Database.insertImmediate method?

I have a class which archives sobject records as big objects. This includes the method Database.insertImmediate(). As this database method counts as a callout, it seems it cannot be covered during ...
Tom P's user avatar
  • 1
1 vote
0 answers
24 views

Stub API not calling trigger

I am using Apex DML mocking using stub api and got a reference from multiple blogs, https://github.com/packocz/Pragmatic-Bear-Blog https://github.com/Coding-With-The-Force/Salesforce-Development-...
sumit's user avatar
  • 479
2 votes
0 answers
65 views

Apex Test.createStub() throwing error for methods with parameter of type: Time

I'm trying to stub an apex class that has a public method with a Time type parameter. I've modified the code slightly from the documentation to include a Time parameter: public class DateHelper { ...
mike537's user avatar
  • 111
0 votes
0 answers
107 views

Stub method from another class

I have stubbed class with name DataUtils and class which i am testing with name DataController. Method from DataUtils that is being called in DataController is web service callout. I cannot use ...
Terdivi's user avatar
  • 51
0 votes
1 answer
140 views

BASHFUL error running testmethod using ApexMocks (StubApi)

Given fflib code that looks like for (Contact c: contacts) { uow.registerEmail(someEmailMessage); } With testmethod ApexMocks verify (which uses StubApi) ((fflib_SObjectUnitOfWork)mocks.verify(...
cropredy's user avatar
  • 67.6k
0 votes
1 answer
220 views

Stub rest api test negative and positive result

I have class where using insertData() method and using stub. I want insertData stub return positive and negative results. How can i do it? Inserted data also is another method which I stub. So its ...
lemleborze's user avatar
0 votes
1 answer
179 views

Custom metadata type in Stub api

I am using trying to stub my class, but I have get and set for custom metadata. I know that I cannot stub get and set. Is there exist any design for using it in stub? Or I must just hardcode it and ...
lemleborze's user avatar
1 vote
1 answer
684 views

Stub api with static methods

I have a global class with a static method which makes post callout and I want to use Stub API, but I don't get how to do it when a method is static. I understand what to do inside mock classes, but I ...
lemleborze's user avatar
-1 votes
1 answer
409 views

how to test the Rest Callout using Stub API

Hi Greetings for the day. using the below code ,I have test the Rest callouts by using Stub API .Test class has been completed with out failure but received code coverage Zero.how to test the Rest ...
sakthidasan's user avatar
2 votes
1 answer
325 views

What qualifies for integration testing within Apex unit test [closed]

We have ~5k unit test running for 6-8 hrs. I want to bring down the runtime. Main contributor is the DMLs in the testsetup and DMLs in the actual class. I want to replace it with Stubbing wherever ...
Raja Vivekanandhan's user avatar
2 votes
1 answer
641 views

Mocking Datacloud.FindDuplicates.findDuplicates(leads) for Integration test

Would be great if someone could point me in the right direction here. I have this static method as follows... public static void createDupeMap(Lead[] leads) { CheckExistingRecords cer = new ...
edralph's user avatar
  • 540
3 votes
1 answer
270 views

Stubbing Logger classes with methods accepting Exceptions

I recently needed to write a test that checks if an exception gets logged. We have a Logger but it's built with static methods, so it cannot be stubbed. But I didn't want to test the Logger logic, so ...
nchursin's user avatar
  • 991
4 votes
2 answers
185 views

Param is unnamed__0 if StubProvider used on interface (instead class)

I am unable to use the System.StubProvider to mock/stub a complicated Backend class of which I have no implementation but only an interface public interface ShopBackend { void initialize(); ...
Robert Sösemann's user avatar
4 votes
2 answers
720 views

ApexMocks, Test.createStub and System.TypeException @Override specified for non-overriding method

Simple use case for ApexMocks of a Service layer class, something I've done a 100 times fflib_ApexMocks mocks = new fflib_ApexMocks(); OpportunitiesServiceImpl mockOpportunitiesService = (...
cropredy's user avatar
  • 67.6k
0 votes
2 answers
526 views

A way to put sobjects to a relationship for faking data?

I'm trying to build a database fake using StubAPI to use in Apex tests. I want to do it to save time on Database interaction (no DMLs and SOQLs) and make tests faster. But I faced an issue with ...
nchursin's user avatar
  • 991