public with sharing class MyClass
{
public MyClass(ApexPages.StandardController con) { try { if(con != null) { // your sObject and any other logic here Account acct = (Account)con.getRecord(); } } catch(Exception ex) { system.debug(ex.getMessage() + ' ' + ex.getStackTraceString()); } } public void myMethod(){} } Then in your test class:
ApexPages.currentPage().getParameters().put('qp', 'yyyy');
|
Thursday, May 19, 2016
APEX: Instantiating a Constructor with a StandardController Parameter in a Test Class
Suppose you have the following class:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment