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
Harsh Singh 7Harsh Singh 7 

Please share the test class for below code

Please create the test class for below code

@RestResource(urlMapping='/Subscriber/*')
global with sharing class MyFirstISID
{
@HttpGet
global static list<string> doGet()
{
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String strEncryptId = req.params.get('EncryptedSub_id');
Id decryptDataSub_id = Cipher.decryptData(String.valueof(strEncryptId ));
Account sampleJSON = [SELECT Id, Name,JSON__c FROM Account WHERE Name =: 'SUBSCRIBER' AND Id =: decryptDataSub_id ];

Object obj = JSON.deserializeUntyped(sampleJSON.JSONAttribute__c ); // converting JSON string into apex primitive data types.


}

return strRes;
}
ANUTEJANUTEJ (Salesforce Developers) 
Hi Harsh,

I found the below link which I think could help you as a refernece to write a test class for the apex rest resource.

>> http://cloudyworlds.blogspot.com/2012/12/writing-test-classes-for-apex-rest.html

In case if this helped you can you please mark this as the best answer.

Regards,
Anutej