Skip to main content
added 109 characters in body
Source Link
Juan
  • 13
  • 3

I have a RestResource class that is called by our backend to perform a specific action. The problem is that when I attempt to test for this class, I run into a snag. The Class accepts a JSON file from our backend and puts into a custom list I create within the class. Here's a snippet:

@RestResource(urlMapping='/restEndpoint/*')
global with sharing class Ecomm_Webhook_Rest {
global class Subscription {
    public String itemId;
    public String licenseId;
    public Integer quantity;
    public String interval;
    public String sku;
}
global class RemovedSubscription {
    public String removedId;
}

@HttpPost
global static void determineWhatNeedsToBeUpdated(
List<Subscription> subscriptions, 
List<RemovedSubscription> removedSubscriptions,
) { // code here
}

The test method I've attempted:

static testMethod void test() {
    List<Ecomm_Webhook_Rest.Subscription> subs = new List<restClass.Subscription>();
    List<Ecomm_Webhook_Rest.RemovedSubscription> removed = new List<restClass.RemovedSubscription>();
    
    Ecomm_Webhook_Rest.determineWhatNeedsToBeUpdated(subs, removed);
    
}
}

I've attempted different lists to send, but each time I keep getting incorrect signature. What could I do to solve this?

Error message:

enter image description here

Turns out there's nothing wrong with the above. What WAS wrong is something not shown here (I removed it thinking it wasn't the issue). I was sending a Date instead of String.

I have a RestResource class that is called by our backend to perform a specific action. The problem is that when I attempt to test for this class, I run into a snag. The Class accepts a JSON file from our backend and puts into a custom list I create within the class. Here's a snippet:

@RestResource(urlMapping='/restEndpoint/*')
global with sharing class Ecomm_Webhook_Rest {
global class Subscription {
    public String itemId;
    public String licenseId;
    public Integer quantity;
    public String interval;
    public String sku;
}
global class RemovedSubscription {
    public String removedId;
}

@HttpPost
global static void determineWhatNeedsToBeUpdated(
List<Subscription> subscriptions, 
List<RemovedSubscription> removedSubscriptions,
) { // code here
}

The test method I've attempted:

static testMethod void test() {
    List<Ecomm_Webhook_Rest.Subscription> subs = new List<restClass.Subscription>();
    List<Ecomm_Webhook_Rest.RemovedSubscription> removed = new List<restClass.RemovedSubscription>();
    
    Ecomm_Webhook_Rest.determineWhatNeedsToBeUpdated(subs, removed);
    
}
}

I've attempted different lists to send, but each time I keep getting incorrect signature. What could I do to solve this?

Error message:

enter image description here

I have a RestResource class that is called by our backend to perform a specific action. The problem is that when I attempt to test for this class, I run into a snag. The Class accepts a JSON file from our backend and puts into a custom list I create within the class. Here's a snippet:

@RestResource(urlMapping='/restEndpoint/*')
global with sharing class Ecomm_Webhook_Rest {
global class Subscription {
    public String itemId;
    public String licenseId;
    public Integer quantity;
    public String interval;
    public String sku;
}
global class RemovedSubscription {
    public String removedId;
}

@HttpPost
global static void determineWhatNeedsToBeUpdated(
List<Subscription> subscriptions, 
List<RemovedSubscription> removedSubscriptions,
) { // code here
}

The test method I've attempted:

static testMethod void test() {
    List<Ecomm_Webhook_Rest.Subscription> subs = new List<restClass.Subscription>();
    List<Ecomm_Webhook_Rest.RemovedSubscription> removed = new List<restClass.RemovedSubscription>();
    
    Ecomm_Webhook_Rest.determineWhatNeedsToBeUpdated(subs, removed);
    
}
}

I've attempted different lists to send, but each time I keep getting incorrect signature. What could I do to solve this?

Error message:

enter image description here

Turns out there's nothing wrong with the above. What WAS wrong is something not shown here (I removed it thinking it wasn't the issue). I was sending a Date instead of String.

added 109 characters in body
Source Link
Juan
  • 13
  • 3

I have a RestResource class that is called by our backend to perform a specific action. The problem is that when I attempt to test for this class, I run into a snag. The Class accepts a JSON file from our backend and puts into a custom list I create within the class. Here's a snippet:

@RestResource(urlMapping='/restEndpoint/*')
global with sharing class Ecomm_Webhook_Rest {
global class Subscription {
    public String itemId;
    public String licenseId;
    public Integer quantity;
    public String interval;
    public String sku;
}
global class RemovedSubscription {
    public String removedId;
}

@HttpPost
global static void determineWhatNeedsToBeUpdated(
List<Subscription> subscriptions, 
List<RemovedSubscription> removedSubscriptions,
) { // code here
}

The test method I've attempted:

static testMethod void test() {
    List<Ecomm_Webhook_Rest.Subscription> subs = new List<restClass.Subscription>();
    List<Ecomm_Webhook_Rest.RemovedSubscription> removed = new List<restClass.RemovedSubscription>();
    
    Ecomm_Webhook_Rest.determineWhatNeedsToBeUpdated(subs, removed);
    
}
}

I've attempted different lists to send, but each time I keep getting incorrect signature. What could I do to solve this?

Error message:

enter image description here

I have a RestResource class that is called by our backend to perform a specific action. The problem is that when I attempt to test for this class, I run into a snag. The Class accepts a JSON file from our backend and puts into a custom list I create within the class. Here's a snippet:

@RestResource(urlMapping='/restEndpoint/*')
global with sharing class Ecomm_Webhook_Rest {
global class Subscription {
    public String itemId;
    public String licenseId;
    public Integer quantity;
    public String interval;
    public String sku;
}
global class RemovedSubscription {
    public String removedId;
}

@HttpPost
global static void determineWhatNeedsToBeUpdated(
List<Subscription> subscriptions, 
List<RemovedSubscription> removedSubscriptions,
) { // code here
}

The test method I've attempted:

static testMethod void test() {
    List<Ecomm_Webhook_Rest.Subscription> subs = new List<restClass.Subscription>();
    List<Ecomm_Webhook_Rest.RemovedSubscription> removed = new List<restClass.RemovedSubscription>();
    
    Ecomm_Webhook_Rest.determineWhatNeedsToBeUpdated(subs, removed);
    
}
}

I've attempted different lists to send, but each time I keep getting incorrect signature. What could I do to solve this?

I have a RestResource class that is called by our backend to perform a specific action. The problem is that when I attempt to test for this class, I run into a snag. The Class accepts a JSON file from our backend and puts into a custom list I create within the class. Here's a snippet:

@RestResource(urlMapping='/restEndpoint/*')
global with sharing class Ecomm_Webhook_Rest {
global class Subscription {
    public String itemId;
    public String licenseId;
    public Integer quantity;
    public String interval;
    public String sku;
}
global class RemovedSubscription {
    public String removedId;
}

@HttpPost
global static void determineWhatNeedsToBeUpdated(
List<Subscription> subscriptions, 
List<RemovedSubscription> removedSubscriptions,
) { // code here
}

The test method I've attempted:

static testMethod void test() {
    List<Ecomm_Webhook_Rest.Subscription> subs = new List<restClass.Subscription>();
    List<Ecomm_Webhook_Rest.RemovedSubscription> removed = new List<restClass.RemovedSubscription>();
    
    Ecomm_Webhook_Rest.determineWhatNeedsToBeUpdated(subs, removed);
    
}
}

I've attempted different lists to send, but each time I keep getting incorrect signature. What could I do to solve this?

Error message:

enter image description here

added 127 characters in body
Source Link
Juan
  • 13
  • 3

I have a RestResource class that is called by our backend to perform a specific action. The problem is that when I attempt to test for this class, I run into a snag. The Class accepts a JSON file from our backend and puts into a custom list I create within the class. Here's a snippet:

@RestResource(urlMapping='/restEndpoint/*')
global with sharing class Ecomm_Webhook_Rest {
global class Subscription {
    public String itemId;
    public String licenseId;
    public Integer quantity;
    public String interval;
    public String sku;
}
global class RemovedSubscription {
    public String removedId;
}

@HttpPost
global static void restMethoddetermineWhatNeedsToBeUpdated(
List<Subscription> subscriptions, 
List<RemovedSubscription> removedSubscriptions,
) { // code here
}

The test method I've attempted:

static testMethod void test() {
    List<Ecomm_Webhook_Rest.Subscription> subs = new List<restClass.Subscription>();
    List<Ecomm_Webhook_Rest.RemovedSubscription> removed = new List<restClass.RemovedSubscription>();
    
    Ecomm_Webhook_Rest.determineWhatNeedsToBeUpdated(subs, removed);
    
}
}

I've attempted different lists to send, but each time I keep getting incorrect signature. What could I do to solve this?

I have a RestResource class that is called by our backend to perform a specific action. The problem is that when I attempt to test for this class, I run into a snag. The Class accepts a JSON file from our backend and puts into a custom list I create within the class. Here's a snippet:

global class Subscription {
    public String itemId;
    public String licenseId;
    public Integer quantity;
    public String interval;
    public String sku;
}
global class RemovedSubscription {
    public String removedId;
}

@HttpPost
global static void restMethod(
List<Subscription> subscriptions, 
List<RemovedSubscription> removedSubscriptions,
) { // code here
}

The test method I've attempted:

static testMethod void test() {
    List<Ecomm_Webhook_Rest.Subscription> subs = new List<restClass.Subscription>();
    List<Ecomm_Webhook_Rest.RemovedSubscription> removed = new List<restClass.RemovedSubscription>();
    
    Ecomm_Webhook_Rest.determineWhatNeedsToBeUpdated(subs, removed);
    
}

I've attempted different lists to send, but each time I keep getting incorrect signature. What could I do to solve this?

I have a RestResource class that is called by our backend to perform a specific action. The problem is that when I attempt to test for this class, I run into a snag. The Class accepts a JSON file from our backend and puts into a custom list I create within the class. Here's a snippet:

@RestResource(urlMapping='/restEndpoint/*')
global with sharing class Ecomm_Webhook_Rest {
global class Subscription {
    public String itemId;
    public String licenseId;
    public Integer quantity;
    public String interval;
    public String sku;
}
global class RemovedSubscription {
    public String removedId;
}

@HttpPost
global static void determineWhatNeedsToBeUpdated(
List<Subscription> subscriptions, 
List<RemovedSubscription> removedSubscriptions,
) { // code here
}

The test method I've attempted:

static testMethod void test() {
    List<Ecomm_Webhook_Rest.Subscription> subs = new List<restClass.Subscription>();
    List<Ecomm_Webhook_Rest.RemovedSubscription> removed = new List<restClass.RemovedSubscription>();
    
    Ecomm_Webhook_Rest.determineWhatNeedsToBeUpdated(subs, removed);
    
}
}

I've attempted different lists to send, but each time I keep getting incorrect signature. What could I do to solve this?

edited tags
Link
Adrian Larson
  • 151.4k
  • 38
  • 247
  • 431
Loading
Source Link
Juan
  • 13
  • 3
Loading