• steveward
  • NEWBIE
  • 0 Points
  • Member since 2005

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Apologies first of all as I am very new to apex but I am struggling to create a test to ensure rows are returned from a test header.id  

 

This is the class 

 

public class SDW_NonRechargeable_Line_Items {

private SFDC_Expense_Header__c header;

private ApexPages.StandardController controller;

 

public SDW_NonRechargeable_Line_Items(ApexPages.StandardController stdController) {

controller = stdController;

header = (SFDC_Expense_Header__c)controller.getRecord();

}

 

public List<Expense_Line_Item__c> NRLineItems {get {

if(header == null){

return new List<Expense_Line_Item__c>();

 

}

List <Expense_Line_Item__c> Non_Rechargeable_Line_Items = [

Select

Name,

Expenditure_Type_Non_Rechargeable__c,

Description__c,

Date__c,

Amount_net__c,

Amount_Gross__c,

CurrencyIsoCode

from Expense_Line_Item__c

where Expense_Report__c = :header.Id order by Date__c];

return Non_Rechargeable_Line_Items;

 

}

set;

}

}

 

 

My test class so far...

 

 

@isTest

private class ExpensesTestSuite {

 

 

static testMethod void run_SDW_NonRechargeable_Line_Items_Tests() {

 

// TO DO: implement unit test

 

List <Expense_Line_Item__c> Non_Rechargeable_Line_Items = new list<Expense_Line_Item__c>();

 

ApexPages.StandardSetController ssc = new

ApexPages.StandardSetController(Non_Rechargeable_Line_Items);

 

 

// Validate bulk SELECT

System.debug('Testing SELECT List return');

 

 

 

//

 

 

}

}

 

Where do I go from here, the examples I see on the forum don't seem to be helping me test for a select as opposed to updates or inserts.

 

Help gratefully appreciated.

 

Regards,

Steve 

 

Apologies first of all as I am very new to apex but I am struggling to create a test to ensure rows are returned from a test header.id  

 

This is the class 

 

public class SDW_NonRechargeable_Line_Items {

private SFDC_Expense_Header__c header;

private ApexPages.StandardController controller;

 

public SDW_NonRechargeable_Line_Items(ApexPages.StandardController stdController) {

controller = stdController;

header = (SFDC_Expense_Header__c)controller.getRecord();

}

 

public List<Expense_Line_Item__c> NRLineItems {get {

if(header == null){

return new List<Expense_Line_Item__c>();

 

}

List <Expense_Line_Item__c> Non_Rechargeable_Line_Items = [

Select

Name,

Expenditure_Type_Non_Rechargeable__c,

Description__c,

Date__c,

Amount_net__c,

Amount_Gross__c,

CurrencyIsoCode

from Expense_Line_Item__c

where Expense_Report__c = :header.Id order by Date__c];

return Non_Rechargeable_Line_Items;

 

}

set;

}

}

 

 

My test class so far...

 

 

@isTest

private class ExpensesTestSuite {

 

 

static testMethod void run_SDW_NonRechargeable_Line_Items_Tests() {

 

// TO DO: implement unit test

 

List <Expense_Line_Item__c> Non_Rechargeable_Line_Items = new list<Expense_Line_Item__c>();

 

ApexPages.StandardSetController ssc = new

ApexPages.StandardSetController(Non_Rechargeable_Line_Items);

 

 

// Validate bulk SELECT

System.debug('Testing SELECT List return');

 

 

 

//

 

 

}

}

 

Where do I go from here, the examples I see on the forum don't seem to be helping me test for a select as opposed to updates or inserts.

 

Help gratefully appreciated.

 

Regards,

Steve