If someone could help me, according to me I am doing the correct assignment of the method parameters, but it tells me that, if someone has an idea it would be very helpful. this is code to evaluate:

public printPackingListWrapper(HealthCloudGA__EhrMedicationPrescription__c medPrescParamObj, OrderItem varOrderItem,String urlParsed, Date varShipOutDueDate){  
    this.medPrescrPatientFill = medPrescParamObj.Patient_Fill_Id__c;


and as I assign it as follows, this is my test class:

@istest  static void printPackingListWrapper2(){
    HealthCloudGA__EhrMedicationPrescription__c he = new HealthCloudGA__EhrMedicationPrescription__c();
    OrderItem        oi      = new OrderItem();
    String str = 'https://salesforce.stackexchange.com/';
    Date fech = Date.today();

    ControllerOrderSummary.printPackingListWrapper item = ControllerOrderSummary.printPackingListWrapper(he, oi,str,fech);

but that shows me that I have badly assigned the parameters, any ideas? help)):

  • Ingles es la idioma solamente aceptable aqui (e majoria otros sitios del StackExchange). Por favor, edite su pregunta.
    – Derek F
    Jul 29 at 14:08
  • method should be return type if nothing return you should at least give void-- public printPackingListWrapper
    – sdandamud1
    Jul 29 at 14:17
  • Please do not delete questions and then recreate near exact copies. This behavior is likely to get you banned from asking questions, especially if you delete questions which have any downvotes.
    – Adrian Larson
    Jul 29 at 14:18
  • @sdandamud1 That's not true if this is a constructor (which a previously deleted question indicates that this is).
    – Derek F
    Jul 29 at 14:19
  • oops my bad, i didn't look his previous Question. i assumed that one is main method.
    – sdandamud1
    Jul 29 at 14:20

The thing that I'm seeing here is that you've left out the new keyword when trying to create a new instance of your PrintPackingListWrapper class.

A quick test via Anonymous Apex shows that missing that keyword does in fact generate the "Method does not exisst of incorrect signature" error.

public class MyInner{
    public MyInner(String str){}

// Note that the 'new' keyword is missing in the below line
// 'new' is generally required when you're making a new instance of an object.
MyInner inst = MyInner('a');

So the primary issue is that you missed the new keyword.

This line in your test class is wrong

ControllerOrderSummary.printPackingListWrapper item = ControllerOrderSummary.printPackingListWrapper(he, oi,str,fech);

and it should instead be

ControllerOrderSummary.printPackingListWrapper item = new ControllerOrderSummary.printPackingListWrapper(he, oi,str,fech);

I'd expect that the next error you'll run into is a null pointer exception due to medPrescParamObj.HealthCloudGA__Encounter__r.HealthCloudGA__Account__r.name;, because it doesn't appear that you have queried or populated any data for the he variable in your test.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.