function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
chandra225chandra225 

about debugging of apex code?

what is the syntax of  positive behaviour and negative behaviour? where it is used? what the impact in apex language?

bob_buzzardbob_buzzard

Are you referring to testing these behaviours rather than debugging?  If so, positive behaviour means that when the correct data is input, your apex code behaves as expected (i.e. that triggers update appropriate fields, visualforce controllers insert records etc).  Negative behaviour is around ensuring that when the code does not receive correct data, it is handled in a graceful fashion. For example, if a field that the trigger/visualforce relies on is null, this is detected and communicated to the user rather than simply sending them to an error page with a stacktrace.

Cory CowgillCory Cowgill

Just to add to what Bob_Buzzard said, Apex has Try/Catch syntax for gracefully handling negative behavior. It also has Unit Test support for testing both positive and negative outcomes via system.assert() functions.

Sridhar BonagiriSridhar Bonagiri

Hi,

 

I believe there is no specifice syntaxes for positive and negative behaviour, the way you passes the data to the fields will decide whethere it is positive or negavite behaviour, but try to use try catch block to avoid any unexpected errors.