function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Asrar RafiqueAsrar Rafique 

Apex SuperBadge

I am receiving weird error while attempting Test Callout (#5), it is giving below error.

Challenge Not yet complete... here's what's wrong: 
The 'WarehouseCalloutServiceTest' class does not appear to be using the 'WarehouseCalloutServiceMock' mock callout class.

But my WarehouseCalloutServiceTest is calling the mock class and it shows 100% code coverage for WarehouseCalloutServiceMock class after running the test. 100% coreage for mock class shows that I am using the class. So,  Can anyone help in figuring what can be the issue.
Jeff DouglasJeff Douglas
Asrar,

Check your WarehouseCalloutServiceTest class. Are you using "test.setMock" to setup the WarehouseCalloutServiceMock class? Are you also calling WarehouseCalloutService.runWarehouseEquipmentSync method?

Jeff Douglas
Trailhead Developer Advocate
Rajesh Ediga 1Rajesh Ediga 1
Can we have Test callout logic code
Kyle Cunningham 6Kyle Cunningham 6
I was encountering the same issue:
I think that this is like a meta-challenge so I don't want to say too much here but for anyone who, like me, comes to this thread looking for an answer I would highly encourage you to RunAll tests in the trailhead org. 
Michael DucheminMichael Duchemin
As Jeff Douglas noted, I believe the challenge is looking for the exact and explicit WarehouseCalloutService.runWarehouseEquipmentSync(); between Test.startTest(); and Test.stopTest();. Even if you were to call it via another method (see below) between start and stop, it will not pass the challenge.

I was pulling my hair out because I did the Superbadge test-driven had 100% test coverage for my entire code base and was passing all of the tests and implementing the mock interface, which is required to pass the tests. My problem is that I also had a WarehouseCalloutService.runWarehouseEquipmentAsync() method that called the sync method. I had written two tests that intended to test the methods separately, but I copied and pasted WarehouseCalloutService.runWarehouseEquipmentAsync(); to both by accident. Because I didn't have the specific method name being called explicitly between start and stop, it was giving the error about not implementing the mock (which was a misdiagnosis of the error).