+ Start a Discussion
Akash Mishra 10Akash Mishra 10 

I am not able to find how can I achieve the test coverage for the nested classes please help me with the code below:

public class Out 
{

    public Meta meta;
    public Response response;

    public class In1
    {
        public List<String> COMPANY;
        public List<String> SUCCESSFUL;
        public List<String> FUNDS;
        public List<String> FAILED;
    }

    public class IN2 
    {
        public Boolean successful;
        public String id;
        public In1 In1;
        public Integer number_of_resources_sent;
        public String access_token;
        public String uuid;
    }

    public class IN3 
    {
        public List<IN4> errors;
        public Integer status_code;
        public Integer version;
        public Double execution_time;
        public Integer timestamp;
    }

    public class IN4 
    {
        public String message;
        public String code;
    }

    public static Response parse(String json) 
    {
        return (Response) System.JSON.deserialize(json, Response.class);
    }
}
 
Manish BhatiManish Bhati
Make a object of the inner classes and then create the variables in the inner class, assigning their values.

Like below:-
Out.In1 innerIn1 = new Out.In1();
innerIn1.COMPANY= { 'ABC', 'XYZ' };
innerIn1.SUCCESSFUL= { 'ABC', 'XYZ' };
innerIn1.FUNDS= { 'ABC', 'XYZ' };
innerIn1.FAILED= { 'ABC', 'XYZ' };

Above will cover In1 inner class.
Akash Mishra 10Akash Mishra 10
Hi Manish,

Thanks for the reply,
I am just checking on the same and then will get back to you,

Thanks