You need to sign in to do that
Don't have an account?
Kruz
how to write test class for location regarding
Hello,
I have no idea of how to write test class for location fetching and all
Please help for writing a test class for it.
Thank You!
I have no idea of how to write test class for location fetching and all
global with sharing class RisksConversationGEO { @testVisible Id RisksConversationId; public string rcName{get; set;} public string lat{get; set;} public string lon{get; set;} string rcLatLon; List<Risk_Conversation__c> rConvDetails= new List<Risk_Conversation__c>(); public RisksConversationGEO(ApexPages.StandardController controller) { system.debug('RisksConversationId:'+ ApexPages.currentPage().getParameters().get('id')); RisksConversationId = ApexPages.currentPage().getParameters().get('id'); //getlocreg(); } public RisksConversationGEO(Id risksConversation1_Id) { if( RisksConversationId == null) { RisksConversationId = risksConversation1_Id; system.debug('risksConversation1_Id: '+ RisksConversationId); //rcName = [select Name from Risk_Conversation__c where Id =:RisksConversationId ]; //riskName = rcName[0].Name; //getlocreg(); } } public void getlocreg() { rConvDetails = [select Twitter_GEO__c, Name from Risk_Conversation__c where Id =: RisksConversationId]; rcName = rConvDetails[0].Name; if(rConvDetails[0].Twitter_GEO__c != NULL) { rcLatLon = rConvDetails[0].Twitter_GEO__c; string[] rcLatLonArr = rcLatLon.split(' '); lat = rcLatLonArr[0]; lon = rcLatLonArr[1]; system.debug('lat :'+lat +'lon :'+lon); } } public string getnametodis(){ rConvDetails = [select Twitter_GEO__c, Name from Risk_Conversation__c where Id =: RisksConversationId]; return rConvDetails[0].Name; // return rcName; } public string getLocation(){ rConvDetails = [select Twitter_GEO__c, Name from Risk_Conversation__c where Id =: RisksConversationId ]; return rConvDetails[0].Twitter_GEO__c; } }
Please help for writing a test class for it.
Thank You!
you have to use this code and you will get 100% code coverage
Test classes are simple
@isTest annotation:
The test class are written under @isTest annotation. By using this annotation for test class we maintain code limit as it is not counted in it.
Create Raw-Data At First:
The Test Class In Apex Salesforce does not have access to any of the data which is stored in the related Salesforce org by default
for more information visit:
https://webkul.com/blog/test-classes-in-apex-salesforce/
If This is your solution please make my answer as best.