Linked Questions

10 votes
4 answers
4k views

Using try, catch and finally in test class (dreamhouseapp)

In the test classes of the DreamHouse Sample app all the functions have the following structure: static testMethod void testSomething() { Boolean success = true; try { ... } catch (...
martes's user avatar
  • 127
3 votes
2 answers
2k views

Test coverage on controller were all functions return null or void

I've only written a few test classes. Each time I've achieved 100%, it involved functions that took args and returned some type of value. How do I test a controller with functions that do not have ...
Tyler Zika's user avatar
  • 2,882
0 votes
3 answers
5k views

How to write a try catch for Rest Api

How do I catch an error if the insert goes wrong in my rest API or is this not needed since I get an API respone? @HttpPost global static ID createInvoice ( String customerId, ...
Thomas's user avatar
  • 2,298
0 votes
1 answer
2k views

How to cover a catch statement in a test class?

I have a simple after insert trigger which inserts a task when an account is created. I am struggling to cover the catch statement in my test class. Is there a way to cover it? Apex Trigger trigger ...
Krishnamurthy's user avatar
4 votes
1 answer
517 views

What can be achieved with Finalizers that was not achievable before?

I have gone through the documentation and read the examples and use cases. However, I am still struggling to understand how Finalizer add value and what can we achieve with it that was not achievable ...
Gabriel Serrano Salas's user avatar
0 votes
1 answer
1k views

Error: System.NullPointerException: Attempt to de-reference a null object

I'm getting these Errors NullPointerException: Attempt to de-reference a null object. and the line are: Class.LeadConvertUtil.convertLead: line 30, column 1 Class.Test_LeadConvertUtil....
Templar's user avatar
  • 175
0 votes
1 answer
672 views

Http send is not working with encoded url parameters

I created one class to make http callout to ftp server.I am using Http mock for test class.Sometimes ftp folders are created with space and it is required to encode the file and folder name in ftp url....
Abhi's user avatar
  • 31
2 votes
2 answers
86 views

How to see swallowing (if) any error messages - unable to save the record!

I'm unable to save the changes that made in the visualforce page. I'm using <apex:inputtextarea/> I have already spent good amount of time trying to figure out but I'm totally clueless now and ...
Nick's user avatar
  • 7,022
-1 votes
1 answer
300 views

how to cover this catch in my batch?

for (APC_I_c rAPC : scope) { rAPC.Error__c = null; rAPC.Type_of_Error__c = null; rAPC.Status__c = 'Processed'; if(rAPC.APC_ID_Account_RCS__c != null){ ...
lulu88's user avatar
  • 1
2 votes
1 answer
76 views

Try Catch Only Reading First Line

I am writing a try catch in my constructor but can not get past the first query of crs. Is there a limit on how many queries you can do in a try catch? What would the reason be for not allowing the ...
Olivia's user avatar
  • 3,461