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
Sadik Shaik 3Sadik Shaik 3 

How to write a test class to cover the deserialize response

Below is the code:
public class UtiityClassl{
public cls_data[] data;
public class cls_data {
public String customerName;
public String Id;
public String opportunityId;
public String Status;
public String Value;
}
public static UtilityClass parse(String json){
return (UtilityClass) System.JSON.deserialize(json, UtilityClass.class);
}
}

Can anyone please help me to write a test class for the above class;
Thanks in Advance
Best Answer chosen by Sadik Shaik 3
Raj VakatiRaj Vakati
Please past yout json string and here is the code
 
@isTest 
public class UtiityClasslTest 
{
	
	 static testMethod void testEx1() 
	 {
		String jsonVal ='' ; 
		UtiityClassl.parse(jsonVal);
		
	 }
}

 

All Answers

Raj VakatiRaj Vakati
Please past yout json string and here is the code
 
@isTest 
public class UtiityClasslTest 
{
	
	 static testMethod void testEx1() 
	 {
		String jsonVal ='' ; 
		UtiityClassl.parse(jsonVal);
		
	 }
}

 
This was selected as the best answer
Sadik Shaik 3Sadik Shaik 3
Thanks Raj Vakati
It's working for me.
janardhanreddy adminjanardhanreddy admin
@Raj Vakati
Thanks a lot