• sfdc rocks 24
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi 
I am newbie in salesforce development. Can someone help me with the test class for the below interface method .

public with sharing class DebugMain {
    
    public interface IMethodEntry
    {
        void MainEntry(String mainObject);
        void InProgressEntry(String mainObject);
    }

    public static IMethodEntry activefunction = null;
    
    public static Boolean FakeException = false;

    public static void MainEntry(String mainObject)
    {   
        DebugHelper.Push('MainEntry mainObject: ' + mainObject);
        try
        {
            if(fakeexception && activefunction==null ) {
                activefunction.InProgressEntry(mainObject);
            }                        
            if(activefunction != null)  
            {
                activefunction.InProgressEntry(mainObject);
                return;
            }   
        
            DebugHelper.Pop();
        }
        catch(Exception ex)
        {
            DebugHelper.DebugException(ex);
            //DebugHelper.DebugException(ex, mainObject);
            DebugHelper.PopAll();   
        }
    }    
}

Some body help me to improve the code coverage and how to pass the activefunction value in to the test class
@isTest
public class DebugMain_Test
{
    
    static testmethod void DebugMain123()
    {          
        //DebugMain d = new DebugMain();
       // DebugMain.IMethodEntry inf = new DebugMain.IMethodEntry();
       // inf.activefunction != null ;        
        //DebugMain.activefunction = ; 
        DebugMain.MainEntry('Account');
        DebugHelper.push('Account');        
        
        LMNX_VF_ServiceReport lsv = new LMNX_VF_ServiceReport();
        lsv.MainEntry('LMNX_VF_ServiceReport');
        lsv.InProgressEntry('LMNX_VF_ServiceReport');
         DebugMain.MainEntry('LMNX_VF_ServiceReport');
         DebugHelper.Pop();          
    }
}
Hi 
I am newbie in salesforce development. Can someone help me with the test class for the below interface method .

public with sharing class DebugMain {
    
    public interface IMethodEntry
    {
        void MainEntry(String mainObject);
        void InProgressEntry(String mainObject);
    }

    public static IMethodEntry activefunction = null;
    
    public static Boolean FakeException = false;

    public static void MainEntry(String mainObject)
    {   
        DebugHelper.Push('MainEntry mainObject: ' + mainObject);
        try
        {
            if(fakeexception && activefunction==null ) {
                activefunction.InProgressEntry(mainObject);
            }                        
            if(activefunction != null)  
            {
                activefunction.InProgressEntry(mainObject);
                return;
            }   
        
            DebugHelper.Pop();
        }
        catch(Exception ex)
        {
            DebugHelper.DebugException(ex);
            //DebugHelper.DebugException(ex, mainObject);
            DebugHelper.PopAll();   
        }
    }    
}

Some body help me to improve the code coverage and how to pass the activefunction value in to the test class
@isTest
public class DebugMain_Test
{
    
    static testmethod void DebugMain123()
    {          
        //DebugMain d = new DebugMain();
       // DebugMain.IMethodEntry inf = new DebugMain.IMethodEntry();
       // inf.activefunction != null ;        
        //DebugMain.activefunction = ; 
        DebugMain.MainEntry('Account');
        DebugHelper.push('Account');        
        
        LMNX_VF_ServiceReport lsv = new LMNX_VF_ServiceReport();
        lsv.MainEntry('LMNX_VF_ServiceReport');
        lsv.InProgressEntry('LMNX_VF_ServiceReport');
         DebugMain.MainEntry('LMNX_VF_ServiceReport');
         DebugHelper.Pop();          
    }
}