Apex class:

public class ProdImedComAr {
    public class Respuesta {
        public Integer Codigo;
        public String Descripcion;
        public Long NroOperacion;
        public String MensajeAdic;
        private String[] Codigo_type_info = new String[]{'Codigo','http://www.w3.org/2001/XMLSchema','int','1','1','false'};
        private String[] Descripcion_type_info = new String[]{'Descripcion','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] NroOperacion_type_info = new String[]{'NroOperacion','http://www.w3.org/2001/XMLSchema','unsignedLong','1','1','false'};
        private String[] MensajeAdic_type_info = new String[]{'MensajeAdic','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'https://test.imed.com.ar/','true','false'};
        private String[] field_order_type_info = new String[]{'Codigo','Descripcion','NroOperacion','MensajeAdic'};

can someone help me on how to write test class for the above


1 Answer 1


You just need to create an instance of the inner class and it should cover the class that you have mentioned in the question.

So the below test class should give you 100% code coverage

public class ProdImedComAr_Test {

    public static void unitTest(){
        ProdImedComAr.Respuesta req = new ProdImedComAr.Respuesta();

But what are you testing with this test class, it does not have any functionality, it only has an inner class, ideally this class should be automatically covered from main class's test class i.e. from the test class of the class where this class is used.

You can refer the canonical question and answer developed by community i.e. How do I write an Apex unit test? which will help in writing test classes.

Not the answer you're looking for? Browse other questions tagged .