Set setIdCases = new Set(); With that being said, it seems like you need more understanding of the apex coding language in general. newItems.add(i2); List newCaseList = new List(); Vehicle__c=vehicleId); We could not find the class MaintenanceRequestHelperTest using assertions in the unit tests. I ll look into it and get back to you shortly. newCases.add(newCase); You signed in with another tab or window. @future(callout=true)public static void runWarehouseEquipmentSync(){, if(response.getStatusCode()==200){//System.debug(size of equipment +equipmentlist.size());List updateEquipmentlist=getProductlist(response);if(updateEquipmentlist.size() > 0){insert new List(updateEquipmentlist);}}}, public static List getProductlist(HttpResponse response){, List externalEquipment = (List) JSON.deserializeUntyped(response.getBody());List equipmentlist=new List();//System.debug(size of result+externalEquipment.size());for (Object externalEquipment1: externalEquipment) {Map data = (Map)externalEquipment1;//system.debug(externalEquipment1);//system.debug(data+===+data.get(cost));Product2 equipment=new Product2();//equipment.Id =(String)data.get(_id);equipment.Cost__c=(Integer)data.get(cost);equipment.Lifespan_Months__c =(Integer)data.get(lifespan);equipment.Maintenance_Cycle__c =(Integer)data.get(maintenanceperiod);equipment.Name =(String)data.get(name);equipment.Current_Inventory__c =(Integer)data.get(quantity);equipment.Replacement_Part__c =(Boolean)data.get(replacement);equipment.Warehouse_SKU__c=(String)data.get(sku);equipmentlist.add(equipment);}return equipmentlist;}, public static HttpResponse getrespond(){Http http=new Http();HttpRequest request=new HttpRequest();request.setEndpoint(WAREHOUSE_URL);request.setMethod(GET);HttpResponse res=Http.send(request);return res;}}, global class WarehouseSyncSchedule implements Schedulable{// implement scheduled code hereglobal void execute (SchedulableContext sc){, WarehouseCalloutService.runWarehouseEquipmentSync();//optional this can be done by debug modeString sch = 00 00 01 * * ?;//on 1 pmSystem.schedule(WarehouseSyncScheduleTest, sch, new WarehouseSyncSchedule());}}, @isTestpublic class MaintenanceRequestTest {, @isTest static void testMaintenanceRequest(){, List maintenanceList=new List();List maintenanceListAfterClosed=new List();Vehicle__c vehicle=new Vehicle__c(Name=tata sumo,Air_Conditioner__c=true,Model__c=23Test);insert vehicle;Product2 equipment=new Product2(Name=tire,Cost__c=100,Current_Inventory__c =10,Replacement_Part__c=true,Warehouse_SKU__c =test,Lifespan_Months__c =10,Maintenance_Cycle__c=10);insert equipment;for(Integer i=1;i<=300;i++){Case maintenance=new Case(Subject=Test subject+i,Type=Routine Maintenance+i,Status=New+i,Origin=Phone+i,Equipment__c=equipment.Id,Vehicle__c=vehicle.Id);maintenanceList.add(maintenance);}insert maintenanceList;// system.assertEquals(300, maintenanceList.size());for(Case caseupdate:maintenanceList){caseupdate.Status=Closed;caseupdate.Type=Routine Maintenance;caseupdate.Date_Due__c=date.Today().addDays(Integer.valueOf(equipment.Maintenance_Cycle__c));maintenanceListAfterClosed.add(caseupdate);}Test.startTest();//UPDATE maintenanceListAfterClosed;//Bulk insert updateDatabase.SaveResult[] updatequipment = Database.update(maintenanceListAfterClosed);Test.stopTest();for(Database.SaveResult sa:updatequipment){System.assert(sa.isSuccess());}}}, @isTestglobal class WarehouseCalloutServiceMock implements HttpCalloutMock {// implement http mock callout//Mock responce created to test the call outglobal HttpResponse respond(HttpRequest request){System.assertEquals(https://th-superbadge-apex.herokuapp.com/equipment', request.getEndpoint());System.assertEquals(GET, request.getMethod());HttpResponse response = new HttpResponse();response.setHeader(Content-Type, application/json);response.setBody([{_id:55d66226726b611100aaf741,replacement:false,quantity:5,name:Generator 1000 kW,maintenanceperiod:365,lifespan:120,cost:5000,sku:100003}]);response.setStatusCode(200);return response;}}, @isTestprivate class WarehouseCalloutServiceTest {// implement your mock callout test here@isTest static void TestWarehouseCalloutService() {Test.startTest();//mock respoonseTest.setMock(HttpCalloutMock.class, new WarehouseCalloutServiceMock());WarehouseCalloutService.runWarehouseEquipmentSync();Test.stopTest();}}, @isTest static void WarehousescheduleTest(){. Save my name, email, and website in this browser for the next time I comment. for(Equipment_Maintenance_Item__c EMIRecord: EMIList){ Currently there arent any specific certification related to health cloud. contact.AccountId = acc.Id; } When I jumped into the super badge I realised that lack a lot of info surrounding the Superbadge. You signed in with another tab or window. im stuck in challenge 4. Hi the challenge has been updated. if(Trigger.isInsert){ } caseToUpdate.add(newCase); ~1 hr 30 mins +1,500 points Module Apex Testing Write robust code by executing Apex unit tests. somethingToUpdate.status = CLOSED; vehicleList.add(createVehicle()); caseIdSet.add(c.Id); Are you sure you want to create this branch? vehicle.Name = car; private static final String WAREHOUSE_URL = https://th-superbadge-apex.herokuapp.com/equipment; public void execute(QueueableContext context){ Apex Specialist Superbadge Trailmix | Salesforce Trailhead maintenanceNew.Date_Reported__c = Date.today(); Challenge 1 - MaintenanceRequest.trigger and MaintenanceRequestHelper.class vehicleToEquipmentMap.put(MRRecord.Vehicle__c,EquipmentIDListUpdate); Case newCase = mapOldCasesWithNewCases.get(idOld); public with sharing class WarehouseCalloutService implements queueable, Database.AllowsCallouts { Case newCase = buildCase(vehicle.Id,'Repair','DummyOK_'+i_ok); SELECT Id, Maintenance_Request__c, Equipment__c , Quantity__c for(Integer i_ok = 0; i_ok < 300; i_ok ++){ TrailheadSalesforce Variable does not exist: Equipment__c Now, you'll have to map to what needs to done. newCase.Origin=web; Continuing my quest with trailhead#SeizetheTrail , the last one in my list is theAdvanced Apex Specialist Superbadge. ), Press J to jump to the feed. Set idOldCases = mapOldCasesWithNewCases.keySet(); }. if(Trigger.isInsert){ insert newItems; newCases = new List(); Dont forget to create the chatter group , update the product trigger to handle only, Override the New and Edit buttons under the Order object to use the OrderEdit visualforce page. Map mapOldCasesWithNewCases = createNewCases(caseList); linkEquipmentsToNewCases(mapOldCasesWithItems,mapOldCasesWithNewCases); Challenge 4 - MaintenanceHelperTest.class pr.Lifespan_Months__c = (Integer)productMap.get(lifespan) ; 1. Case newCase = new Case(); Equipment_Maintenance_Item__c newItem = new Equipment_Maintenance_Item__c(); pazhukh/Advanced-Apex-Specialist-Salesforce-Super-Badge newItem.Quantity__c = item.Quantity__c; String joBID= System.schedule(TestScheduleJob, CRON_EXP, new WarehouseSyncSchedule()); Account acc = new Account(); }. salesforce - Advanced Apex Specialist - Please ensure that the Select As it's currently written, it's hard to understand your solution. Also various YouTube videos and blogs exist. } Thats a technical error. If nothing happens, download GitHub Desktop and try again. Hi, private class WarehouseSyncScheduleTest { Apex Specialist Superbadge. This is probably the simplest of all the steps.. update theTestDataFactory class to handle the key requirements given.. I am getting invalid type schema: for work_part__c, can you help me how to resolve this on, it doesnt seems typo error, but i cant find any field of such type also. to use Codespaces. if(MRRecord.Vehicle__c==EMIRecord.Maintenance_Request__r.Vehicle__c){ Advanced Apex Specialist step 1 - Salesforce Developer Community SYSTEM.assertEquals(newReq.ProductId, equipmentId); if(MRRecord.Vehicle__c==EMIRecord.Maintenance_Request__r.Vehicle__c){ Help with Superbadge Apex Specialist Step 3? There can be technical errors n it might take more than one time to get it verified. System.assertEquals(1000,caseList.size()); for(Case cas:caseList){ What video game is Charlie playing in Poker Face S01E07? Test automation logic || Apex Specialist Superbadge Education Org's 273 subscribers Subscribe 23 Share 6.4K views 6 months ago Apex Specialist - Superbadge This is Apex Specialist Superbadge. Integer numberOfDays = Integer.valueOf(leastValueMap.get(c.Id).Equipment__r.Maintenance_Cycle__c); Please help me out, have you solved this if yes please help me, i have already used Queueable interface for WarehouseCalloutService class now i m stuck on step 5 with Test class WarehouseCalloutServiceTest , can you please help me with Test class code ,underlying is the Queueable interface code of WarehouseCalloutService class. Its a pretty long post that i wrote quiet long time back. @istest Date newDate = Date.today(); if(result.get(oneCase.Id)!=null) { System.schedule , JobIdJobIDCronTriggerJob Could you please point out the specifics. Superbadge business administration specialist challenge 4 Product2 newEquipment = new Product2(); This link helped me, so I modified the code like this: Thanks for contributing an answer to Stack Overflow! Please update challenge 6 and all the respective things related to it. I create correct algoritm to find less maintenance cycle days. Product2 pr = new Product2(); I'm working on the Apex Specialist super badge on the Salesforce Trailhead. Please We are always on the hunt for writers that have something interesting to say! from Equipment_Maintenance_Item__c from case]; Equipment_Maintenance_Item__c workPart = [select id Apex Specialist Trailmix | Salesforce Trailhead newCase.Date_Reported__c=Date.today(); Test automation logic || Apex Specialist Superbadge - YouTube private static final string REQUEST_ORIGIN = Web; List secondList = new List(); Account acc = [SELECT Id, Name FROM Account WHERE Name = test LIMIT 1]; for(Case MRRecord: newList){ thanks! Integer addDays=0; MaintenanceRequestHelper.updateWorkOrders(); b. Test.stopTest(); maintenanceNew.Vehicle__c = vehicle.Id; @istest update caseToUpdate; for(Case MRRecord: newList){ newEMIRecord.Maintenance_Request__c=MRRecord.ID; Date todayDate = System.today(); mapCases.put(oldCaseId,new List());