• Lovel Panchal
  • NEWBIE
  • 15 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
I am facing issues to clear the mentioned test, Please can some one look into this and help me out.
Help appericiated.
Challenge


Data of Product(Equipment)Code which ran successfully

The Code which I am using:

public with sharing class WarehouseCalloutService {
    
    private static final String WAREHOUSE_URL = 'https://th-superbadge-apex.herokuapp.com/equipment';
    @future(callout=true)
    // complete this method to make the callout (using @future) to the
    // REST endpoint and update equipment on hand.
    public static void runWarehouseEquipmentSync(){
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint(WAREHOUSE_URL);
        request.setMethod('GET');
        HttpResponse response = http.send(request);
        // If the request is successful, parse the JSON response.
        String ret = '';
        if (response.getStatusCode() == 200) {
            // Deserialize the JSON string into collections of primitive data types.
            List<Object> results = (List<Object>) JSON.deserializeUntyped(response.getBody());
            
            List<Product2> LstProduct = new List<Product2>();
            for(Object obj : results)
            { 
                Map<String, Object> mapobj = (Map<String, Object>)obj;
                Product2 product = new Product2();
                           
                Integer maintenanceperiod = (Integer)mapobj.get('maintenanceperiod');               
                Integer Lifespan = (Integer)mapobj.get('lifespan');
                Integer Cost = (Integer)mapobj.get('cost');
                Boolean replacement = (Boolean)mapobj.get('replacement');
                Integer quantity = ((Integer)mapobj.get('qIntegerntity'));
                product.Name  = (String)mapobj.get('name'); 
                product.Maintenance_Cycle__c = Integer.valueof(maintenanceperiod);
                product.Cost__c = Cost;
                product.Current_Inventory__c = quantity;
                product.Lifespan_Months__c = Lifespan; 
                product.Replacement_Part__c = replacement;
                product.Warehouse_SKU__c = (String) mapobj.get('sku');
                product.ProductCode = (String)mapobj.get('_id');       
                LstProduct.add(product);
            }
            System.debug(LstProduct);
            upsert LstProduct;
        }
        
    }
}
I have completed the challange and also tested it, all is working fine but then also when I check challange its throws the below mention error.
Challenge Not yet complete... here's what's wrong: 
No Apex test class named 'AnimalLocatorTest' was found.

Challange name is Apex Integration Services > Apex REST Callouts.
Please can you help me out in this.
 
I want that when I am binding by checkboxs at that time only based on condition I can make checkbox by default selected or unslected.

So how can I achieve that 

here's my apex code

public List<SelectOption> getChkboxItems() {
        List<SelectOption> options = new List<SelectOption>();           
        for(lovel__Item__c i: getitms()){
            boolean x =false;
            for(lovel__Item_Manufacture_Mapper__c imm: [SELECT lovel__Item__c FROM lovel__Item_Manufacture_Mapper__c WHERE lovel__Manufacturer__c = :id]){
                if(i.Id == imm.lovel__Item__c) {
                    x=true;
                }                 
            }
            options.add(new SelectOption(i.Id,i.Name,x));
        }
        return options;
    }
I am facing issues to clear the mentioned test, Please can some one look into this and help me out.
Help appericiated.
Challenge


Data of Product(Equipment)Code which ran successfully

The Code which I am using:

public with sharing class WarehouseCalloutService {
    
    private static final String WAREHOUSE_URL = 'https://th-superbadge-apex.herokuapp.com/equipment';
    @future(callout=true)
    // complete this method to make the callout (using @future) to the
    // REST endpoint and update equipment on hand.
    public static void runWarehouseEquipmentSync(){
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint(WAREHOUSE_URL);
        request.setMethod('GET');
        HttpResponse response = http.send(request);
        // If the request is successful, parse the JSON response.
        String ret = '';
        if (response.getStatusCode() == 200) {
            // Deserialize the JSON string into collections of primitive data types.
            List<Object> results = (List<Object>) JSON.deserializeUntyped(response.getBody());
            
            List<Product2> LstProduct = new List<Product2>();
            for(Object obj : results)
            { 
                Map<String, Object> mapobj = (Map<String, Object>)obj;
                Product2 product = new Product2();
                           
                Integer maintenanceperiod = (Integer)mapobj.get('maintenanceperiod');               
                Integer Lifespan = (Integer)mapobj.get('lifespan');
                Integer Cost = (Integer)mapobj.get('cost');
                Boolean replacement = (Boolean)mapobj.get('replacement');
                Integer quantity = ((Integer)mapobj.get('qIntegerntity'));
                product.Name  = (String)mapobj.get('name'); 
                product.Maintenance_Cycle__c = Integer.valueof(maintenanceperiod);
                product.Cost__c = Cost;
                product.Current_Inventory__c = quantity;
                product.Lifespan_Months__c = Lifespan; 
                product.Replacement_Part__c = replacement;
                product.Warehouse_SKU__c = (String) mapobj.get('sku');
                product.ProductCode = (String)mapobj.get('_id');       
                LstProduct.add(product);
            }
            System.debug(LstProduct);
            upsert LstProduct;
        }
        
    }
}
I have completed the challange and also tested it, all is working fine but then also when I check challange its throws the below mention error.
Challenge Not yet complete... here's what's wrong: 
No Apex test class named 'AnimalLocatorTest' was found.

Challange name is Apex Integration Services > Apex REST Callouts.
Please can you help me out in this.