Strange APEX unit test behavior when splitting SOQL queries (or any line of code for that matter)
Today I ran into an odd situation. Writing some APEX test code, I noticed that coverage for an APEX SOQL query is calculated in an odd way. It seems that splitting SOQL queries across multiple lines might add up to less coverage than creating a long SOQL statement on 1 line. This is particularly strange, since one of the best-practises when writing code, is to create readable code, splitting long SOQL queries across multiple lines. It is actually an element that’s part of the scoring by judges, when taking the SFDC Advanced Developer practical assignment.
Ofcourse, splitting a SOQL query across … Continue Reading