Here is my apex class, I would like to create the test class of it so that its coverage code must be 100%.Can anyone help me to create its test class.
@RestResource(urlMapping='/v2/getUpsell/*')
global with sharing class REST_Upsell_Controller {
@HttpPost
global static String processUpsell(String orderId){
ChargentOrders__ChargentOrder__c order = [SELECT Id, ChargentOrders__Charge_Amount__c, ChargentOrders__Tax__c, ChargentOrders__Subtotal__c FROM ChargentOrders__ChargentOrder__c WHERE Id = :orderId];
order.ChargentOrders__Subtotal__c = 600.66;
try {
update order;
return 'Upsell Added';
} catch (DmlException e) {
return 'Upsell Not Added';
}
}
}