• Stephanie Gethers
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies

Hello when i am try to upload apex class and visualforce its say my that i need least 75% coverage..

if i try to upload this like Packages this is over the upload but when i am try to upload to Outbound Change Sets, i get only 45 % how its can be?

what can do i to upload the %....?

apex class:

public class appspotApiMedSuppController {
    
    public  string fieldName  {get;set;}
    public  JSONParser parser  {get;set;}
    
    public  string full_name {get;set;}
    public  string plan {get;set;}
    
    public  Integer quarter{get;set;}
    public  Integer annual{get;set;}
    public  Integer semi_annual{get;set;}
    public  Integer month{get;set;}
    
    public  rateClass rate{get;set;}
    public class rateClass {
        public  Integer quarter{get;set;}
        public  Integer annual{get;set;}
        public  Integer semi_annual{get;set;}
        public  Integer month{get;set;}
    }
    
    public  String type{get;set;}
    public  String name{get;set;}
    public  Double value{get;set;}
    
    public discountsClass discounts{get;set;}
    public class discountsClass {
        public  String type{get;set;}
        public  String name{get;set;}
        public  Double value{get;set;}
    }

    
    public class MedSupp {
       public  String full_name{get;set;}
       public  String plan{get;set;}
       public  String expires_date{get;set;}
       public  rateClass rate{get;set;}
       public  discountsClass  discounts{get;set;}
    }
    public MedSupp med_supp{get;set;}
    public List<MedSupp> dataList {get;set;}
   
    public String zip {get;set;}
    public String gender {get;set;}
    public String tobacco {get;set;}
    public String expires_date{get;set;}
    
    public String Dateeffective {get;set;}
    public String requestEndPoint {get;set;}
    public Date birth {get;set;}
    public Integer age {get;set;}
   
   
    public static HttpResponse getInfoFromExternalService() {
        HttpRequest req = new HttpRequest();
        req.setHeader('x-api-token', '3e63919db53fbaebe6f3c0ea316645ce3aa24c64402be35a157653e9fe12ad77');
        req.setEndpoint('link');
        req.setTimeout(15000);
        req.setMethod('GET');
        Http h = new Http();
        HttpResponse res = h.send(req);
        return res;
    }
   
   
    public  appspotApiMedSuppController (){
        Date effectiveDate = Date.today();
        birth =  (System.currentPageReference().getParameters().get('birth')!=null)? date.parse(System.currentPageReference().getParameters().get('birth')) : Date.today();
           if( Date.newInstance(2000, birth.month(), birth.day()) <= Date.newInstance(2000, effectiveDate.month(), effectiveDate.day()))
            {

                age = effectiveDate.year() - birth.year();
            }
            else
            {    
                age = effectiveDate.year() - birth.year() -1;
            }
                
        if(effectiveDate.month()!=12)
            effectiveDate = Date.newInstance(effectiveDate.year(), effectiveDate.month()+1, 1);
        else
           effectiveDate = Date.newInstance(effectiveDate.year()+1,1, 1);
        
        Dateeffective = effectiveDate.year()+'-'+effectiveDate.month()+'-'+effectiveDate.day();

        zip = null;
        gender=null;
        tobacco =null;
        zip = System.currentPageReference().getParameters().get('zip');
        gender = System.currentPageReference().getParameters().get('gender');
        tobacco = System.currentPageReference().getParameters().get('tobacco');
        
        requestEndPoint='link';

        
       
        Http http =new Http();
        HttpRequest request = new HttpRequest();
        request.setHeader('x-api-token', '6a3e8d00b0183e4d9fd9a2dbd058ec26aecd412920034145254d780b0d6c2fe6');
        request.setEndpoint(requestEndPoint);
        request.setTimeout(15000);
        request.setMethod('GET');
        HttpResponse response = http.send(request);
        
        if(response.getStatusCode() ==200){
           dataList = new List<MedSupp>();
           
            parser = JSON.createParser(response.getBody());
           while (parser.nextToken() != null) {
               
                if (parser.getCurrentToken() == JSONToken.START_ARRAY) {
                    while (parser.nextToken() != null) {
                         med_supp = new MedSupp();rate = new rateClass();discounts = new discountsClass();fieldName = parser.getText();
                        if (fieldName == 'company_base'){
                            parser.nextToken();
                            if (parser.getCurrentToken() == JSONToken.START_OBJECT) {
                                while (parser.nextToken() != null)
                                {
                                    fieldName = parser.getText();
                                    if(fieldName == 'parent_company_base')
                                    {
                                        parser.nextToken();parser.nextToken();parser.nextToken();parser.nextToken();parser.nextToken();parser.nextToken();parser.nextToken();
                                        full_name = parser.getText();
                                        break;
                                    } 
                               
                                }
                            }
                        }
                        if (fieldName == 'rate'){ parser.nextToken();rate =(rateClass)parser.readValueAs(rateClass.class);}
                        if (fieldName == 'plan'){parser.nextToken();plan = parser.getText();   }
                        if (fieldName == 'discounts'){parser.nextToken();parser.nextToken();discounts=(discountsClass)parser.readValueAs(discountsClass.class);}
                        if (fieldName == 'location_base'){parser.nextToken();parser.nextToken();parser.nextToken();expires_date = parser.getText();expires_date = expires_date.substring(0,expires_date.indexOf('T'));}
                        if (fieldName == 'age'){
                          if((plan=='F') || (plan=='N')|| (plan=='G'))
                          {
                               med_supp.full_name = full_name;
                               med_supp.plan = plan;
                               med_supp.expires_date=expires_date;
                               med_supp.rate = rate;
                               med_supp.discounts = discounts;
                               dataList.add(med_supp);
                          }
                          
                        }
                      
                    }
                    
                }
                    
            }
        }
        else{
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,' There was an error retrieving the data information.');
        }
    }
}


 

Hello this is the first time that i used apex, so i build apex class and visualforce when i try to deploy it , i get error that i need to build apex test.. 
my apex class use only 3d api that i get ,and take all the data ..

Hello i am trying to upload apex class and visualForce and i get the error :
Your organization's code coverage is 0%. You need at least 75% coverage to complete this deployment. Also, the following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
Sum_Account_Revenue
No_Answer_Count
CountTaskNumber

some one tell me that i need to build testing Apex. but in the error i get files that alredy works few month :  Sum_Account_Revenue,No_Answer_Count,CountTaskNumber

 

so i dont know what to do , and if i need to do testing how i do it becouse all the documents apoke about triger and i dont have (i dont need )

public with sharing class appspotApiMedSuppController {
    public  string fieldName  {get;set;}
    public  JSONParser parser  {get;set;}
    
    public  string full_name {get;set;}
    public  string plan {get;set;}
    
    public  Integer quarter{get;set;}
    public  Integer annual{get;set;}
    public  Integer semi_annual{get;set;}
    public  Integer month{get;set;}
    public  rateClass rate{get;set;}
    
    public class rateClass {
        public  Integer quarter{get;set;}
        public  Integer annual{get;set;}
        public  Integer semi_annual{get;set;}
        public  Integer month{get;set;}
    }
    
    public  String type{get;set;}
    public  String name{get;set;}
    public  Double value{get;set;}
    
    public discountsClass discounts{get;set;}
    
    public class discountsClass {
        public  String type{get;set;}
        public  String name{get;set;}
        public  Double value{get;set;}
    }

    
    public class MedSupp {
       public  String full_name{get;set;}
       public  String plan{get;set;}
       public  String expires_date{get;set;}
       public  rateClass rate{get;set;}
       public  discountsClass  discounts{get;set;}
    }
    public MedSupp med_supp{get;set;}
    public List<MedSupp> dataList {get;set;}
   
    public String zip {get;set;}
    public String gender {get;set;}
    public String tobacco {get;set;}
    public String expires_date{get;set;}
    
    public String Dateeffective {get;set;}
    public String requestEndPoint {get;set;}
    public Date birth {get;set;}
    public Integer age {get;set;}
   
    public  appspotApiMedSuppController (ApexPages.StandardController stdController ){
        Date effectiveDate = Date.today();
        birth =  date.parse(System.currentPageReference().getParameters().get('birth'));
        
        zip = System.currentPageReference().getParameters().get('zip');
        gender = System.currentPageReference().getParameters().get('gender');
        tobacco = System.currentPageReference().getParameters().get('tobacco');
        
        String requestEndPoint='https://google.com';
        requestEndPoint= 'https://google.com?age='+age+'&zip5='+zip+'&gender='+gender+'&tobacco='+tobacco+'&effective_date='+Dateeffective;
        
       
        Http http =new Http();
        HttpRequest request = new HttpRequest();
        request.setHeader('x-api-token', '6a3e8d00b0183e4d9fd9a2dbd058ec26aecd412920034145254d780b0d6c2fe6');
        request.setEndpoint(requestEndPoint);
        request.setTimeout(15000);
        request.setMethod('GET');
        HttpResponse response = http.send(request);
        
        if(response.getStatusCode() ==200){
           dataList = new List<MedSupp>();
           
           JSONParser parser = JSON.createParser(response.getBody());
           while (parser.nextToken() != null) {
               
                if (parser.getCurrentToken() == JSONToken.START_ARRAY) {
                    while (parser.nextToken() != null) {
                         med_supp = new MedSupp();
                        fieldName = parser.getText();
                       
                        if (fieldName == 'company_base'){
                            
                            parser.nextToken();
                            if (parser.getCurrentToken() == JSONToken.START_OBJECT) {
                                while (parser.nextToken() != null)
                                {
                                    fieldName = parser.getText();
                                    if(fieldName == 'parent_company_base')
                                    {
                                        parser.nextToken();parser.nextToken();parser.nextToken();
                                        parser.nextToken();parser.nextToken();parser.nextToken();parser.nextToken();
                                        full_name = parser.getText();
                                        break;
                                    } 
                               
                                }
                            }
                        }
                        if (fieldName == 'rate'){
                            parser.nextToken();
                            rate =(rateClass)parser.readValueAs(rateClass.class);
                           
                        }
                        if (fieldName == 'plan'){
                            parser.nextToken();
                            plan = parser.getText();
                           
                           
                        }
                        if (fieldName == 'discounts'){
                            parser.nextToken();
                            parser.nextToken();
                            discounts=(discountsClass)parser.readValueAs(discountsClass.class);
                           
                        }
                         if (fieldName == 'location_base'){
                            parser.nextToken();
                            parser.nextToken();
                            parser.nextToken();
                            expires_date = parser.getText();
                            expires_date = expires_date.substring(0,expires_date.indexOf('T'));
                            
                        }
                        
                        if (fieldName == 'age'){
                          if((plan=='F') || (plan=='N')|| (plan=='G'))
                          {
                               med_supp.full_name = full_name;
                               med_supp.plan = plan;
                               med_supp.expires_date=expires_date;
                               med_supp.rate = rate;
                               med_supp.discounts = discounts;
                               dataList.add(med_supp);
                          }
                          
                        }
                      
                    }
                    
                }
                 
              
            }
        }
        else{
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,' There was an error retrieving the data information.');
        }
    }
}

Hello if i i have class how can i  print the verible int the class:

for example :

<apex:outputText value="{!discounts}"/>
 

and i get the result of :

discountsClass:[name=household, type=percent, value=0.07]
how can i get the varible inside like the name?

 

Hello when i am try to upload apex class and visualforce its say my that i need least 75% coverage..

if i try to upload this like Packages this is over the upload but when i am try to upload to Outbound Change Sets, i get only 45 % how its can be?

what can do i to upload the %....?

apex class:

public class appspotApiMedSuppController {
    
    public  string fieldName  {get;set;}
    public  JSONParser parser  {get;set;}
    
    public  string full_name {get;set;}
    public  string plan {get;set;}
    
    public  Integer quarter{get;set;}
    public  Integer annual{get;set;}
    public  Integer semi_annual{get;set;}
    public  Integer month{get;set;}
    
    public  rateClass rate{get;set;}
    public class rateClass {
        public  Integer quarter{get;set;}
        public  Integer annual{get;set;}
        public  Integer semi_annual{get;set;}
        public  Integer month{get;set;}
    }
    
    public  String type{get;set;}
    public  String name{get;set;}
    public  Double value{get;set;}
    
    public discountsClass discounts{get;set;}
    public class discountsClass {
        public  String type{get;set;}
        public  String name{get;set;}
        public  Double value{get;set;}
    }

    
    public class MedSupp {
       public  String full_name{get;set;}
       public  String plan{get;set;}
       public  String expires_date{get;set;}
       public  rateClass rate{get;set;}
       public  discountsClass  discounts{get;set;}
    }
    public MedSupp med_supp{get;set;}
    public List<MedSupp> dataList {get;set;}
   
    public String zip {get;set;}
    public String gender {get;set;}
    public String tobacco {get;set;}
    public String expires_date{get;set;}
    
    public String Dateeffective {get;set;}
    public String requestEndPoint {get;set;}
    public Date birth {get;set;}
    public Integer age {get;set;}
   
   
    public static HttpResponse getInfoFromExternalService() {
        HttpRequest req = new HttpRequest();
        req.setHeader('x-api-token', '3e63919db53fbaebe6f3c0ea316645ce3aa24c64402be35a157653e9fe12ad77');
        req.setEndpoint('link');
        req.setTimeout(15000);
        req.setMethod('GET');
        Http h = new Http();
        HttpResponse res = h.send(req);
        return res;
    }
   
   
    public  appspotApiMedSuppController (){
        Date effectiveDate = Date.today();
        birth =  (System.currentPageReference().getParameters().get('birth')!=null)? date.parse(System.currentPageReference().getParameters().get('birth')) : Date.today();
           if( Date.newInstance(2000, birth.month(), birth.day()) <= Date.newInstance(2000, effectiveDate.month(), effectiveDate.day()))
            {

                age = effectiveDate.year() - birth.year();
            }
            else
            {    
                age = effectiveDate.year() - birth.year() -1;
            }
                
        if(effectiveDate.month()!=12)
            effectiveDate = Date.newInstance(effectiveDate.year(), effectiveDate.month()+1, 1);
        else
           effectiveDate = Date.newInstance(effectiveDate.year()+1,1, 1);
        
        Dateeffective = effectiveDate.year()+'-'+effectiveDate.month()+'-'+effectiveDate.day();

        zip = null;
        gender=null;
        tobacco =null;
        zip = System.currentPageReference().getParameters().get('zip');
        gender = System.currentPageReference().getParameters().get('gender');
        tobacco = System.currentPageReference().getParameters().get('tobacco');
        
        requestEndPoint='link';

        
       
        Http http =new Http();
        HttpRequest request = new HttpRequest();
        request.setHeader('x-api-token', '6a3e8d00b0183e4d9fd9a2dbd058ec26aecd412920034145254d780b0d6c2fe6');
        request.setEndpoint(requestEndPoint);
        request.setTimeout(15000);
        request.setMethod('GET');
        HttpResponse response = http.send(request);
        
        if(response.getStatusCode() ==200){
           dataList = new List<MedSupp>();
           
            parser = JSON.createParser(response.getBody());
           while (parser.nextToken() != null) {
               
                if (parser.getCurrentToken() == JSONToken.START_ARRAY) {
                    while (parser.nextToken() != null) {
                         med_supp = new MedSupp();rate = new rateClass();discounts = new discountsClass();fieldName = parser.getText();
                        if (fieldName == 'company_base'){
                            parser.nextToken();
                            if (parser.getCurrentToken() == JSONToken.START_OBJECT) {
                                while (parser.nextToken() != null)
                                {
                                    fieldName = parser.getText();
                                    if(fieldName == 'parent_company_base')
                                    {
                                        parser.nextToken();parser.nextToken();parser.nextToken();parser.nextToken();parser.nextToken();parser.nextToken();parser.nextToken();
                                        full_name = parser.getText();
                                        break;
                                    } 
                               
                                }
                            }
                        }
                        if (fieldName == 'rate'){ parser.nextToken();rate =(rateClass)parser.readValueAs(rateClass.class);}
                        if (fieldName == 'plan'){parser.nextToken();plan = parser.getText();   }
                        if (fieldName == 'discounts'){parser.nextToken();parser.nextToken();discounts=(discountsClass)parser.readValueAs(discountsClass.class);}
                        if (fieldName == 'location_base'){parser.nextToken();parser.nextToken();parser.nextToken();expires_date = parser.getText();expires_date = expires_date.substring(0,expires_date.indexOf('T'));}
                        if (fieldName == 'age'){
                          if((plan=='F') || (plan=='N')|| (plan=='G'))
                          {
                               med_supp.full_name = full_name;
                               med_supp.plan = plan;
                               med_supp.expires_date=expires_date;
                               med_supp.rate = rate;
                               med_supp.discounts = discounts;
                               dataList.add(med_supp);
                          }
                          
                        }
                      
                    }
                    
                }
                    
            }
        }
        else{
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,' There was an error retrieving the data information.');
        }
    }
}


 

Hello this is the first time that i used apex, so i build apex class and visualforce when i try to deploy it , i get error that i need to build apex test.. 
my apex class use only 3d api that i get ,and take all the data ..

Hello i am trying to upload apex class and visualForce and i get the error :
Your organization's code coverage is 0%. You need at least 75% coverage to complete this deployment. Also, the following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
Sum_Account_Revenue
No_Answer_Count
CountTaskNumber

some one tell me that i need to build testing Apex. but in the error i get files that alredy works few month :  Sum_Account_Revenue,No_Answer_Count,CountTaskNumber

 

so i dont know what to do , and if i need to do testing how i do it becouse all the documents apoke about triger and i dont have (i dont need )

public with sharing class appspotApiMedSuppController {
    public  string fieldName  {get;set;}
    public  JSONParser parser  {get;set;}
    
    public  string full_name {get;set;}
    public  string plan {get;set;}
    
    public  Integer quarter{get;set;}
    public  Integer annual{get;set;}
    public  Integer semi_annual{get;set;}
    public  Integer month{get;set;}
    public  rateClass rate{get;set;}
    
    public class rateClass {
        public  Integer quarter{get;set;}
        public  Integer annual{get;set;}
        public  Integer semi_annual{get;set;}
        public  Integer month{get;set;}
    }
    
    public  String type{get;set;}
    public  String name{get;set;}
    public  Double value{get;set;}
    
    public discountsClass discounts{get;set;}
    
    public class discountsClass {
        public  String type{get;set;}
        public  String name{get;set;}
        public  Double value{get;set;}
    }

    
    public class MedSupp {
       public  String full_name{get;set;}
       public  String plan{get;set;}
       public  String expires_date{get;set;}
       public  rateClass rate{get;set;}
       public  discountsClass  discounts{get;set;}
    }
    public MedSupp med_supp{get;set;}
    public List<MedSupp> dataList {get;set;}
   
    public String zip {get;set;}
    public String gender {get;set;}
    public String tobacco {get;set;}
    public String expires_date{get;set;}
    
    public String Dateeffective {get;set;}
    public String requestEndPoint {get;set;}
    public Date birth {get;set;}
    public Integer age {get;set;}
   
    public  appspotApiMedSuppController (ApexPages.StandardController stdController ){
        Date effectiveDate = Date.today();
        birth =  date.parse(System.currentPageReference().getParameters().get('birth'));
        
        zip = System.currentPageReference().getParameters().get('zip');
        gender = System.currentPageReference().getParameters().get('gender');
        tobacco = System.currentPageReference().getParameters().get('tobacco');
        
        String requestEndPoint='https://google.com';
        requestEndPoint= 'https://google.com?age='+age+'&zip5='+zip+'&gender='+gender+'&tobacco='+tobacco+'&effective_date='+Dateeffective;
        
       
        Http http =new Http();
        HttpRequest request = new HttpRequest();
        request.setHeader('x-api-token', '6a3e8d00b0183e4d9fd9a2dbd058ec26aecd412920034145254d780b0d6c2fe6');
        request.setEndpoint(requestEndPoint);
        request.setTimeout(15000);
        request.setMethod('GET');
        HttpResponse response = http.send(request);
        
        if(response.getStatusCode() ==200){
           dataList = new List<MedSupp>();
           
           JSONParser parser = JSON.createParser(response.getBody());
           while (parser.nextToken() != null) {
               
                if (parser.getCurrentToken() == JSONToken.START_ARRAY) {
                    while (parser.nextToken() != null) {
                         med_supp = new MedSupp();
                        fieldName = parser.getText();
                       
                        if (fieldName == 'company_base'){
                            
                            parser.nextToken();
                            if (parser.getCurrentToken() == JSONToken.START_OBJECT) {
                                while (parser.nextToken() != null)
                                {
                                    fieldName = parser.getText();
                                    if(fieldName == 'parent_company_base')
                                    {
                                        parser.nextToken();parser.nextToken();parser.nextToken();
                                        parser.nextToken();parser.nextToken();parser.nextToken();parser.nextToken();
                                        full_name = parser.getText();
                                        break;
                                    } 
                               
                                }
                            }
                        }
                        if (fieldName == 'rate'){
                            parser.nextToken();
                            rate =(rateClass)parser.readValueAs(rateClass.class);
                           
                        }
                        if (fieldName == 'plan'){
                            parser.nextToken();
                            plan = parser.getText();
                           
                           
                        }
                        if (fieldName == 'discounts'){
                            parser.nextToken();
                            parser.nextToken();
                            discounts=(discountsClass)parser.readValueAs(discountsClass.class);
                           
                        }
                         if (fieldName == 'location_base'){
                            parser.nextToken();
                            parser.nextToken();
                            parser.nextToken();
                            expires_date = parser.getText();
                            expires_date = expires_date.substring(0,expires_date.indexOf('T'));
                            
                        }
                        
                        if (fieldName == 'age'){
                          if((plan=='F') || (plan=='N')|| (plan=='G'))
                          {
                               med_supp.full_name = full_name;
                               med_supp.plan = plan;
                               med_supp.expires_date=expires_date;
                               med_supp.rate = rate;
                               med_supp.discounts = discounts;
                               dataList.add(med_supp);
                          }
                          
                        }
                      
                    }
                    
                }
                 
              
            }
        }
        else{
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,' There was an error retrieving the data information.');
        }
    }
}