1.

How To Unit Test Code Which Has Logic Around The Created Date?

Answer»
  • You can create sObjects in memory with arbitrary CreatedDate values by using JSON.deserialize. This doesn’t enforce the normal read-only field attributes that prevent you from setting a createdDate value. However, you can’t commit arbitrary CreatedDate values to the database (or else it would be a serious security issue).
  • Detecting GOVERNOR limits through apex
  • First of all, the EXCEPTION thrown by HITTING a limit, System.LimitException is uncatchable and means that your script will be killed, EVEN if it happens inside a try/catch block. There is a class, Limits, that contains a number of static methods that allow you to CHECK your governor limit consumption.



Discussion

No Comment Found