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
Mr.BrooksMr.Brooks 

Testing a small Page Reference Class

I have created a queue that holds data in an object in Salesforce. I have researched others who have had some similar issues but nothing is helping so far. Here is the code for it. I am just not sure how to test it, I have have the code that i tried to test it below as well. Can anyone please help me out and not just send me to a link?

Controller:
public class CreateNewExceptionFromCures{
   
    public String ActRecTypeID = [SELECT Name, Id, DeveloperName, SobjectType FROM RecordType where SobjectType = 'Deal_Exceptions__c' and developerName = 'retail'].Id;
     
       
    //Create method for button to pass thru
    public CreateNewExceptionFromCures(ApexPages.StandardController stdController){
       
        //List deal = Query id, appNum from Cure where id = id of cure page
       
    }  

    //Create blank method{}
    public CreateNewExceptionFromCures(){}

   
   
  
    //create void method to populate field
    public PageReference hello1(){
       
        List<Cure__c> deal = [SELECT Id, Application_Number__c, Applicant_Name__c FROM CURE__c WHERE id = :ApexPages.currentPage().getParameters().get('Id')];
     List<Opportunity> opp = [Select ID, Application_number__c From Opportunity where Application_number__c = :deal[0].Application_number__c];
        
     //exCat = Query for category from Exception Category with description other
     List<Exception_Category__c> exCat = [SELECT Exception_Category_Description__c, Id, Exception_Category_Code__c, Name FROM Exception_Category__c where Exception_Category_Code__c = '99'];
       
     //create new exception record and populate the source field = cure
     Deal_Exceptions__c d = new Deal_Exceptions__c(Opportunity__c = opp[0].ID, Source__c = 'Cure', Category__c = exCat[0].id); //opp, category and recordype is required
           
        System.debug('CATEGORY IS*******: '+ d.category__c);       
        insert d;         
                                 
  PageReference reference=new PageReference('https://cs20.salesforce.com/'+ d.id);
        //PageReference reference = new ApexPages.StandardController(d).view();
       
  reference.setRedirect(true);
        return reference;
    }
}

--------------------------------------------------------------------TEST CLASS----------------------------------------------

@isTest
public class CreateNewExceptionFromCuresTest{
    public CreateNewExceptionFromCuresTest(){
      
        CreateNewExceptionFromCures ne = new CreateNewExceptionFromCures();
       system.assertEquals(page.success, ne.hello1());
      
        Cure__c cur = new Cure__c();
      
        Deal_Exceptions__c d = new Deal_Exceptions__c();
        ApexPages.StandardController std = new ApexPages.StandardController(d);
        CreateNewExceptionFromCures thecontroller1 = new CreateNewExceptionFromCures(std);
        thecontroller1.hello1();
       
    }
   
}
Ramu_SFDCRamu_SFDC
The below posts has an example of testing page reference classes which might help

http://salesforce.stackexchange.com/questions/14495/test-class-not-sending-page-reference
http://christopheralunlewis.blogspot.in/2011/08/writing-unit-tests-for-pagereference.html
Mr.BrooksMr.Brooks
None of that is an example of how i am using it though and it is not making sense.