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
Arun KArun K 

Test class for getalladdress() method

I am trying to write test method for below Class.

 

"

 

public with sharing class RemotingAddressesController_differential {



public RemotingAddressesController_differential(Axtria_controller_differential controller) {

}

 


public String getAccounts() {
return null;
}

public String userId = UserInfo.getUserId(); 

@RemoteAction
public static List<account> getAllAddresses(){

List <account> addresses = 
[SELECT id,name,Billingstreet,billingstate,billingpostalcode,billingcity,Location__Latitude__s,Location__Longitude__s FROM account WHERE Active__c='Yes' LIMIT 10000];
return addresses;
}


}

 

 

"

 

The test class for that is 

"

@isTest
public class TestAxtria_RemoteAddress{
public static testMethod void test(){
account account= new account(Billingstreet='PINNELL ST',billingpostalcode='25271',AxtriaCallPlan__Location__Latitude__s=38.43,AxtriaCallPlan__Location__Longitude__s=-82.13,Name='MICHAEL SHRAMOWIAT',AxtriaCallPlan__Active__c='yes',AxtriaCallPlan__Specialization_differential__c='PHA',AxtriaCallPlan__Account_First_Nmae__c='MICHAEL' ,AxtriaCallPlan__Account_Last_Name__c='SHRAMOWIAT',AxtriaCallPlan__Territory_Name__c='Richmond VA',AxtriaCallPlan__Approval__c='New',Billingcity='RIPLEY',Billingstate='WV',AxtriaCallPlan__Submit__c=True);
insert account;

Apexpages.StandardController stdController = new Apexpages.StandardController(account);
RemotingAddressesController_differential controller = new RemotingAddressesController_differential (stdController );

list<account>ocrs= controller .getAllAddresses();
System.assertEquals(1,ocrs.size());

}
}

"

 

 

Please correct the test class so that I can cover the class.

 

Thanks

Arun K

 

 

venkatsforcevenkatsforce

list<account>ocrs= controller .getAllAddresses();

After this line you retrieve all inserting account values using query and then check the condition.....
System.assertEquals(1,ocrs.size());

Arun KArun K

I am tryin to correct it.. But Couldnt cover the code.

 

Please post the required lines to cover

Please help in covering the code 

 

Thanks

Arun K