0
global with sharing class Controller { 
  public String actId{get;set;}

    public treeInlineController(ApexPages.StandardController sc){
        List<Contact> = new List<contact>();



@isTest
    public class Controller_Test{
        static testMethod void unitTest() {

        }

    }
1
  • You need to create an ApexPages.StandardController instance and then pass that to new treeInlineController as an argument. And passing as an argument does not need, or allow, the type to be specified. Simply pass sc. Commented Jan 21, 2016 at 10:58

2 Answers 2

3

Update your test class -

Folder_Items__c fc = new Folder_Items__c();
// fc.field = value
insert fc;
treeInlineController objInline = new treeInlineController(new ApexPages.StandardController(fc));
1
  • thanks @Peeyush, its working and my test class covered 100% Commented Jan 21, 2016 at 11:02
0

In your test class, when you are instantiating the object from class treeInlineController. The constructor is expecting the parameter of type ApexPages.StandardController

So pass the parameter in the constructor in your test class

Folder_Items__c folderitem = new Folder_Items__c();
//additional code here
treeInlineController objInline = new treeInlineController(new ApexPages.StandarcController(folderitem));
2
  • treeInlineController constructor accept ApexPages.StandardController not Folder_Items__c object
    – Ratan Paul
    Commented Jan 21, 2016 at 11:11
  • 1
    @ratan thanks! that's what I mentioned in the post but missed out on the code
    – Jarvis
    Commented Jan 21, 2016 at 11:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .