I've composed an apex classes in sanbox, test classes as well. It works fine in sandbox. Now i wanna deploy to prod without using changesets and packages.

a part of apex

   protected RestClient() {

a part of test class

    Test.setMock(HttpCalloutMock.class, new HistoryMock());
    RestClient dummy = new RestClient();

my manual deployment fails with

force-app\main\default\classes\RestClientTest.cls Method is not visible: void RestClient.()

but it really works fine in sandbox when i try to deploy target class with

sfdx force:source:deploy -m ApexClass:RestClient -l RunSpecifiedTests -r RestClientTest

i always get

Deploy ID: 0AfSc0000001d0vKAA DEPLOY PROGRESS | ████████████████████████████████████████ | 1/1 Components

=== Test Results Summary

Passing: 0 Failing: 0 Total: 0 Time: 0 Error (1): Deploy failed.

What am i doing wrong?

1 Answer 1


Try the Compile All Classes feature mentioned in Manage Apex Classes. You'll find this in Setup > Custom Code > Apex Classes. The most likely scenario is that there is another class that needs access to the constructor in order to compile, and Sandbox/Developer/Scratch Orgs do not perform a full compile to make deployments quicker. You may also want to pull down all of your production org's code and try deploying to the Sandbox. This way, you'll know about any other compile errors that may be lurking.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .