apex specialist superbadge

private class MaintenanceRequestHelperTest {, @testSetup LocaleSidKey=en_US, ProfileId = p.Id, Salesforce Interview Questions and Answers We Swear By! SYSTEM.assertEquals(newReq.Date_Reported__c, system.today()); @istest +13,000 points ~12 hrs App Builder Super Set Superbadge Complete the capstone assessment to earn the App Builder Super Set. Hi, Its giving error for me . // Sync with Warehouse Hope this helps. }. $ sfdx force:source:retrieve -n NameOfThePackage This will retrieve all the components in the package into a new folder named as the package. update caseToUpdate; rev2023.3.3.43278. Is it a bug? I ll look into it and get back to you shortly. The followings are the challenges to earn this badge: Automate record creation using Apex triggers. @isTest So glad you cared to share this. id vehicleId = vehicle.Id; Product2 equipment = createEq(); I tried to use your code as it is and it gives error..For this superbadge I already read on 7th Dec that Superbadge challenge will be changed on 9th Dec and I am unaware about old superbadge so cant tell you what actual changes are. Vehicle__c vehicle = [SELECT Id, Name FROM Vehicle__c WHERE Name = car LIMIT 1]; list workPartList = new list(); setIdCases.add(caseInList.Id); List listEquipmentMaintenanceItem = When I jumped into the super badge I realised that lack a lot of info surrounding the Superbadge. Id oldCaseId = item.Maintenance_Request__c; } insert emptyReq; Equipment_Maintenance_Item__c workP = createWorkPart(equipmentId, emptyReq.Id); }, PRIVATE STATIC Case createMaintenanceRequest(id vehicleId, id equipmentId){ WHERE Maintenance_Request__c IN :setIdCases]; Map mapCases = new Map(); please help. I had posted these at the time i completed them. newCase.Subject=subjectCase; Date newDate = Date.today(); if(result.get(oneCase.Id)!=null) { from Equipment_Maintenance_Item__c There can be technical errors n it might take more than one time to get it verified. 2023 TechForce Services. Map newCases = new Map(); Origin=REQUEST_ORIGIN, Please create a seperate trailhead playground for each superbadge challenge. Equipment_Maintenance_Item__c newItem = new Equipment_Maintenance_Item__c(); static void allTheDataForThisTestClass() {. private class WarehouseSyncScheduleTest { where status =: STATUS_NEW]; list workParts = [select id Share to someone in the Trailhead Community. Apex Specialist Tips, Copyright 2000-2017 salesforce.com, inc.All rights reserved., Trailhead Reports & Dashboards Specialist, https://developer.salesforce.com/docs/atlas.ja-jp.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_apexgov.htm, https://developer.salesforce.com/docs/atlas.ja-jp.apexcode.meta/apexcode/apex_scheduler.htm. Equipment_Maintenance_Item__c i2 = buildItem(newCases[i_fail].Id, equipment.Id); }, @isTest static void test_triggerMaintenanceRequestHelperTest() {. Challenge 6 - WarehouseSyncScheduleTest.class. Review the data schema in your modified Salesforce org as you read the detailed requirements below. update secondList; Apex Specialist Challenge 1 too Many DML Rows. insert acc; Contact contact = new Contact(); Please Guide me.. @istest Challenge 2 - WarehouseCalloutService.class It's pretty comprehensive and contains several examples. equipmentList.add(createEq()); 2UnixCron, Apex Map mapOldCasesWithNewCases = createNewCases(caseList); linkEquipmentsToNewCases(mapOldCasesWithItems,mapOldCasesWithNewCases); requestList.add(createMaintenanceRequest(vehicleList.get(i).id, equipmentList.get(i).id)); acc.Name = test; List EMIList = new List([SELECT Maintenance_Request__c,Maintenance_Request__r.Vehicle__c,Equipment__c, Equipment__r.Maintenance_Cycle__c,Quantity__c FROM Equipment_Maintenance_Item__c WHERE Maintenance_Request__r.Vehicle__c IN: newRoutineMaintenanceVehicleRecordIDList]); }, public static void createNewEquipmentMaintenanceItem(Map newMap){ Retry the process aforementioned. maintenanceNew.Status = 'New'; Asking for help, clarification, or responding to other answers. You have to insert as many work parts records for each inserted new case record. public with sharing class WarehouseCalloutService implements queueable, Database.AllowsCallouts {. Apex @future Hot Network Questions Would merfolk need beds? 3 Answers. https://developer.salesforce.com/docs/atlas.ja-jp.apexcode.meta/apexcode/apex_scheduler.htm, ApexGUISchedulable Apex, [] [] [Apex] Apex , GUISalesforce Please edit your answer to include an explanation of your code. Hope this helps!Looking For? Map mapOldCasesWithItems = getItemsInOldCases(caseList); List newMRRecordList = new List(); Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. It should work. Staging Ground Beta 1 Recap, and Reviewers needed for Beta 2, What is wrong with my code on Trailhead challenge Developer Beginner > Apex Triggers > Bulk Apex Triggers, Apex Lightning upload fail because missing test class, How can I modify the meta data of any field using apex, How do i write test class for below apex code, Lightning Web Component Specialist Super badge: Challenge 7, Trailhead Superbadge Logic to create Junction Object, Apex Specialist Challenge 1 too Many DML Rows, Theoretically Correct vs Practical Notation. newCase.Status=closed; ), Press J to jump to the feed. Continuing my quest with trailhead#SeizetheTrail , the last one in my list is theAdvanced Apex Specialist Superbadge. Apex SpecialistSuperbadge,Challenge-1 : Automate Record Creation,Challenge-2 : Synchronize Salesforce data with an external system. Maintenance_Request__c = requestId); I'm working on the Apex Specialist super badge on the Salesforce Trailhead. insert contact; Vehicle__c vehicle = new Vehicle__c(); }. } upsert newProducts; Please find the link to telegram group on the homepage! SELECT Maintenance_Request__r.ID cID, MIN(Equipment__r.Maintenance_Cycle__c)cycle Honestly, I suggest reviewing the trailheads leading up to the apex super badge since the apex specialist Superbadge tests you on those core concepts. I had cleared this superbadge way back in time would have to seriously redo it to understand what was done on this one. public class Constants { public static final Integer DEFAULT_ROWS = 5; public static final String SELECT_ONE = Label.Select_One; public static final String INVENTORY_LEVEL_LOW = Label.Inventory_Level_Low; public static final List<Schema.PicklistEntry . insert vehicle; Apex Specialist. request.setEndpoint(WAREHOUSE_URL); Trailhead, , (Super Badge) } But i will surely get back to you on this. Code shared by Laendor is not working. Create your own notes with your understanding and you can ask a senior at work to review them for you. Salesforce Trailhead Superbadge: Apex Specialist Solution Challenge 1: Automate record creation STEP 1: Create a new Trailhead Playground Install the unmanaged Package Rename Case to Maintenance Request and Product to Equipment STEP 2: Automate record creation using Apex Trigger Update the trigger MaintenanceRequest: newMRRecord.Date_Due__c=date.today(); where Maintenance_Request__c = :emptyReq.Id]; system.assert(workPart != null); return Vehicle; https://takesurveyguide.com/safeway-customer-survey/. maintenanceNew.ContactId = contact.Id; for(Case MRRecord: newMap.values()){ You signed in with another tab or window. Are you sure you want to create this branch? Please update challenge 6 and all the respective things related to it. List EquipmentIDListUpdate = vehicleToEquipmentMap.get(MRRecord.Vehicle__c); Copy the name of the package and use this command in the terminal. List newProducts = new List(); for(Object p : externalProducts) Apex specialist superbadge challenge 4. contact.Email = test@test.com; } . private static final string REQUEST_SUBJECT = Testing subject; PRIVATE STATIC Vehicle__c createVehicle(){ It did not work for me. newCase.Origin = 'Phone'; insert requestList; for(integer i = 0; i < 300; i++){ Stuck on Superbadge Apex Specialist Step 4? insert workP; test.startTest(); Case newCase = new Case(); Tips . if(Trigger.isInsert){ } You have to rename the two standard fields as indicated and then the mentioned changes in apex and trigger codes. With that being said, it seems like you need more understanding of the apex coding language in general. One question, how does the map newCases get updated with the new Case IDs following the insert tmpCases? newCase.Date_Reported__c = System.today(); Subject=REQUEST_SUBJECT, newRoutineMaintenanceVehicleRecordIDList.add(MRRecord.Vehicle__c); A limit involving the quotient of two sums, Doubling the cube, field extensions and minimal polynoms, Calculating probabilities from d6 dice pool (Degenesis rules for botches and triggers), Euler: A baby on his lap, a cat on his back thats how he wrote his immortal works (origin?). For any superbadge, you will have to install a package before starting. Actions to Earn This Superbadge Automate record creation using Apex triggers public static String CRON_EXP = 0 0 0 15 3 ? if(MRRecord.Type==Routine Maintenance){ // ToDo: Call MaintenanceRequestHelper.updateWorkOrders Did any DOS compatibility layers exist for any UNIX-like systems before DOS started to become outmoded? Maintenance Request to the same vehicle . If you don't get the complete picture of super badge, you can jot down the requirements and connect them(like a process flow diagram). Skip to content. Salesforce, Trailhead, superbadge This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. If u further need help you can join the telegram group from link on the homepage. vehicleList.add(createVehicle()); } for(Integer i_fail = 0; i_fail < 300; i_fail ++){ So with that I could solve it. GitHub - minicruiser/Apex-Specialist-Superbadge minicruiser / Apex-Specialist-Superbadge Public Notifications 13 Star Code Issues main 1 branch 0 tags Go to file Code minicruiser Update MaintenanceRequestHelper.cls 8b195dd on Jun 6, 2022 14 commits step2 Automate record creation Update MaintenanceRequestHelper.cls 8 months ago public with sharing class MaintenanceRequestHelperTest {. Thank you for this solution! Test.startTest() Test.stopTest() , , startTeststopTest, A. Super BadgeUnlockTipsTrailheadTipsUnlock Apologies for m caught quite off guard at this moment. pr.Current_Inventory__c = (Integer)productMap.get(quantity); List items = mapOldCasesWithItems.get(idOld); newEMIRecord.Equipment__c=EMIRecord.Equipment__c; newEMIRecord.Equipment__c=EMIRecord.Equipment__c; }. Tips, ApexWeb APIApexDML1, Trigger.new sObject List Use Git or checkout with SVN using the web URL. Alternatively you can join our telegram group for technical discussions among industry professionals, Hey komal. workPartList.add(createWorkPart(equipmentList.get(i).id, requestList.get(i).id)); } trigger MaintenanceRequest on Case (before update, after update, before insert, after insert) { You must have 100% test coverage to pass this challenge and assert values to prove that your logic is working as expected. // TODO: Complete the method to update workorders, public static void createNewMaintenanceRequest(Map oldMap, Map newMap){ if(!newRoutineMaintenanceVehicleRecordIDList.contains(MRRecord.Vehicle__c)) Apologies for the codes have changed. Please provide additional details in your answer. I do know the core concepts but I am missing the connection. } pr.Lifespan_Months__c = (Integer)productMap.get(lifespan) ; I am working on "Advanced Apex Specialist" Superbadge but I am not able to pass challenge 1 as it keeps on showing me that Select one label is not created. A place where magic is studied and practiced? insert product; List secondList = new List(); Account acc = [SELECT Id, Name FROM Account WHERE Name = test LIMIT 1]; Salesforce for(Case MRRecord: newMap.values()){ Trailhead solution for Apex Specialist superbadge } Trailhead newItems.add(i2); Challenge 4 - MaintenanceHelperTest.class mukesh gupta. I would recommend you to follow the blog rather than looking into the code. I create correct algoritm to find less maintenance cycle days. I have complete Idea of this coding bt I am not getting what to do before writing this code exactly for this challenge. I'm having a really hard time finishing this challenge. I am stuck in challenge 6. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. Equipment_Maintenance_Item__c newItem = new Equipment_Maintenance_Item__c(); Is there a specific import order? } private static final string WORKING = Working; Install the unmanaged package for the schema and stubs for Apex classes and triggers. Ask Question Asked 1 year, 3 months ago. maintenanceNew.Date_Due__c = Date.today(); caseList.add(maintenanceNew); pr.Cost__c = (Integer)productMap.get(cost); Cant remember precisely. 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. Hey Haja. public static Vehicle__c buildVehicle(){ List newRoutineMaintenanceVehicleRecordIDList = new List(); I would recommend you to follow the blog rather than looking into the code. Challenge 3 - WarehouseSyncSchedule.class Advanced-Apex-Specialist-Salesforce-Super-Badge. System.debug(*** Total cases (expected 900): +numberAllCases); What is a word for the arcane equivalent of a monastery? e.Equipment__c = emis.Equipment__c; 2022; static testmethod void testjob(){ If nothing happens, download Xcode and try again. Hi Shaid, Please use below code:-. Test.stopTest(); i wanted to excel myself in healthcloud domain of salesforce as i have started badges of that domain on trailhead } Learn. Hi, Showcase your mastery of business process automation without writing a line of code. Find centralized, trusted content and collaborate around the technologies you use most. for(Case MRRecord: newMap.values()){ } newCase.Type=Routine Maintenance; This is the message I get: I was able to solve it, when trailhead runs the testing is doing a count query to Cases based on the Subject, I didn't put the subject when the case is created as new. Account acc = new Account(); same error for me too.. can you please help me out, hi e.Maintenance_Request__c = oldNewCaseMap.get(emis.Maintenance_Request__c).Id; ~2 hrs 15 mins +2,200 points Module Asynchronous Apex List newEMIRecordList = new List(); system.debug(newRoutineMaintenanceVehicleRecordIDList +newRoutineMaintenanceVehicleRecordIDList); , Apex, ApexHttpCalloutMock Map caseKeys = new Map (CaseIDs); Eigenmann & Veronelli un Gruppo internazionale che nasce nel 1910 leader nella distribuzione di specialit chimiche e ingredienti alimentari per l'industria.. Con circa 340 dipendenti e . Vehicle__c Vehicle = new Vehicle__C(name = SuperTruck); ChangethelabelsforStandard Objectsand Fields in SalesforceGo to Setup -> Customize -> Tab Names andLabels->RenameTabs andLabels. If nothing happens, download GitHub Desktop and try again. newEMIRecordList.add(newEMIRecord); update requestList; { newCase.Status=New; }, insert listEquipmentMaintenanceItem; insert vehicle; newEMIRecord.Maintenance_Request__c=MRRecord.ID; emptyReq.Status = WORKING; } System.debug(*** Updated cases: +caseToUpdate.size()); Integer numberAllCases = (Integer) [SELECT COUNT(Id) conteggio FROM Case WHERE Date_Reported__c = TODAY][0].get(conteggio); newMRRecord.Vehicle__c = MRRecord.Vehicle__c; Tips3, PlaygroundTrailhead Reports & Dashboards Specialist . hi, martand please lemme know if it is verified, I ll update the same! Apex Specialist is one of the superbadges of Salesforce trailhead (A New Approach to Learning Salesforce) . @future pr.Name = (String)productMap.get(name); public static void testPositive(){ We could not find the class MaintenanceRequestHelperTest using assertions in the unit tests. sign in newCases.add(newCase); This link helped me, so I modified the code like this: Thanks for contributing an answer to Stack Overflow! insert newItems; newCases = new List(); Apex Code Development (89731) General Development (54672) Visualforce Development (37117) Lightning (17463) APIs and Integration (16704) Trailhead (11575) Formulas & Validation Rules Discussion (11140) Other Salesforce Applications (7994) . newMRRecordList.add(newMRRecord); im geting error, newEMIRecord.Quantity__c=EMIRecord.Quantity__c; Synchronize Salesforce data with an external system using asynchronous REST callouts. Closing a Maintenance Request of type Routine Maintenance did not create of a new . if(maintenanceCycle>0) In that case the post hasnt been updated that much recently. I am unaware of any changes. for(Integer i_ok = 0; i_ok < 300; i_ok ++){ for(Id oldId : oldIdCases){ newCase.Origin=web; }, @isTest if(!EquipmentIDListUpdate.contains(EMIRecord.Equipment__c)){ CronTrigger a=[SELECT Id FROM CronTrigger where NextFireTime > today]; System.assertEquals(jobID, a.Id,Schedule ); Originally published at https://shivshankarsfdc.com on July 29, 2019. for(Case newCase : [SELECT Id, Comments, Vehicle__c, Status FROM Case WHERE Subject LIKE DummyOK%]){ All these codes are working 100% and run smoothly to help you achieve the below shiny badge. if(Trigger.isUpdate){ req.Status = CLOSED; Hi Admin, if(!leastValueMap.containsKey(emi.Maintenance_Request__c)){ Map vehicleToEquipmentMap = new Map(); Copyright 2000-2022 Salesforce, Inc. All rights reserved. List newCaseList = new List(); Issue with Superbadge Apex Specialist Step 5? Getting so many queries on this one I will surely try prioritize. Work fast with our official CLI. Hey Nikhil. System.assert(numberAllCases==600); vehicleToEquipmentMap.put(MRRecord.Vehicle__c,EquipmentIDListUpdate); Use the naming conventions specified in the requirements document to ensure a successful deployment. } List emiList = new List(); Try it. secondList.add(cas); public static void testNegative(){ And I might not be the best to advice on that particular section. for(Id idOld : idOldCases){ , ApexApex()75%Apex(1%) private static final String WAREHOUSE_URL = https://th-superbadge-apex.herokuapp.com/equipment; public void execute(QueueableContext context){ Trailblazer CommunityTrailhead, ApexSalesforce Developer, Trailhead vol2. Please help! Challenge 4: both negative and bulk run successfully but not positive test case. Apex Specialist Superbadge. This query will return all completed batch, future, and queryable jobs that were completed today. insert equipment; newProducts.add(pr); insert somethingToUpdate; Equipment_Maintenance_Item__c workP = createWorkPart(equipmentId,somethingToUpdate.id); newMRRecord.Type=Routine Maintenance; Salesforce[] [] [], REST API document.getElementById( "ak_js_1" ).setAttribute( "value", ( new Date() ).getTime() ); Ever loved someone so much, you would do anything for them? Do lemme know if you find solutions codes that work well for it. Also search for blogs, articles regarding it. what objects I have to make all those things..Can anyone please give Stepwise ,clear and simplified solution of the same? What sort of strategies would a medieval military use against a fantasy giant? pr.Replacement_Part__c = (Boolean)productMap.get(replacement); Thanks for your wonderful gesture of letting know, I am also geating the same error . newCases.put(oneCase.Id, newRoutineCase); insert newEMIRecordList; system.assert(allRequest.size() == 1); Would have to get back to you. } https://techevangel.com/2018/06/01/superbadge-advanced-apex-specialist/. Let the universe renounce some goodness to you . Hey nelson..Save that test class first and then use the same, for Challenge #2 please run System.enqueueJob(new WarehouseCalloutService()); in Anonymous window, this will work for sure, Can someone please share the working code for 4th (this) challenge. } I have Class name MaintenanceRequestHelper and i am adding it but still it not accepting this getting below error. List externalProducts = (List) JSON.deserializeUntyped(response.getBody()); Product2 newEquipment = new Product2(); +2,000 points ~1 hr App Customization Specialist Superbadge ProductId=equipmentId, } ApexSchedulable , execute, I am getting Variable does not exist: MaintenanceRequestTest error. newEMIRecordList.add(newEMIRecord); if(vehicleToEquipmentMap.get(MRRecord.Vehicle__c)!=null){ } insert equipment; oldRequestIds.add(req.Id); Follow guided learning paths. { Alternatively you can join our telegram group for technical discussions among industry professionals. Laendor code is not working. maintenanceCycle=EMIRecord.Equipment__r.Maintenance_Cycle__c; I'm also trying to get more comfortable with Visual Studio Code with the Salesforce extensions. Apex Specialist Superbadge Trailmix | Salesforce Trailhead Laura Thomas +19,700 Points +1,000 points Module Apex Triggers Write Apex triggers to perform custom database actions. check if u have creted a process builder , i did create a proces builder and deactivated and it worked for me. public static void updateWorkOrders(List caseList) { insert vehicleList; FROM Equipment_Maintenance_Item__c Yeah, well make that someone yourself and do whatever the hell you want.. Maybe not optimized! cas.Status = 'Closed'; { This repository is for solving all the problems and pass all the challenges in the way of earning this superbadge. newCase.Date_Due__c=Date.today(); public static Equipment_Maintenance_Item__c buildItem(Id caseId, Id equipmentId){ FROM Equipment_Maintenance_Item__c where Maintenance_Request__r.ID in :caseKeys.keySet() } Discover your ideal career. enter image description here Tried creating another playground but still same issue. newEMIRecord.Quantity__c=EMIRecord.Quantity__c; EquipmentIDListUpdate.add(EMIRecord.Equipment__c); caseToUpdate.add(newCase); Case maintenanceNew = new Case(); Vehicle__c vehicle = buildVehicle(); contact.FirstName = test; product.Maintenance_Cycle__c = 2; Hard times, Challenge 1 : Automate record creation Case newMRRecord = new Case(); }, public static void updateNewMaintenanceRequest(List newList){ Product2 equipment = buildEquipment(); }. Hey itachi, try debugging the code and look where the issue is. Could you please point out the specifics. update somethingToUpdate; Case newReq = [Select id, subject, type, Date_Reported__c, Vehicle__c, Date_Due__c pr.Maintenance_Cycle__c = (Integer)productMap.get(maintenanceperiod); insert equipmentList; for(integer i = 0; i < 300; i++){ salesforce Share Improve this question Follow newCase.Type = 'Routine Maintenance'; REST APICall GROUP BY Maintenance_Request__r.ID ]; Please lemme know if works. @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(){. else if(leastValueMap.containsKey(emi.Maintenance_Request__c) && emi.Equipment__r.Maintenance_Cycle__c < leastValueMap.get(emi.Maintenance_Request__c).Equipment__r.Maintenance_Cycle__c){ for(Equipment_Maintenance_Item__c EMIRecord: EMIList){

St Lawrence County News, Articles A

apex specialist superbadge