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
Mac D GreeneMac D Greene 

Validation Failed when deploying

This is my second attempt at trying to deploy this Jira Connector Apex to Production. I have fixed many other errors but these are outside my scope.The first attempt had 23 issues. I have attempted to reach out to Service Rocket support but have had no response.


User-added image
CreateIssueTest - The error is with the last line of code. Cant figure out what it needs to be to pass??
@isTest public class CreateIssueTest implements HttpCalloutMock {
private static HttpRequest request;
private static HttpResponse response;

public HTTPResponse respond(HTTPRequest req) {
    request = req;
    response = new HttpResponse();
    response.setStatusCode(200);
    return response;
}

@isTest static void createIssueTriggerTest() {
    Test.setMock(HttpCalloutMock.class, new CreateIssueTest());
    Case case1 = new Case();

    Test.startTest();
    insert case1;
    Test.stopTest();

    System.assertEquals(JIRA.baseUrl + '/rest/customware/connector/1.0/' + JIRA.systemId + '/Case/' + case1.id + '/issue/create.json', request.getEndpoint());
}
}


 
v varaprasadv varaprasad
Hi Mac,
Remove System.assertEquals(JIRA.baseUrl + '/rest/customware/connector/1.0/' + JIRA.systemId + '/Case/' + case1.id + '/issue/create.json', request.getEndpoint());

Hope this helps you!

Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
 
Mac D GreeneMac D Greene
User-added image

Does the @test class have to test something else within this code?
 
trigger CreateIssue on CDR__c (after update) {

  // Check whether current user is not JIRA agent so that we don't create an infinite loop.
  if (JIRA.currentUserIsNotJiraAgent()) {
    
    for (CDR__c c :Trigger.new) {
    //Check each record if approved by approval process
    if(c.Approved__c && !Trigger.oldMap.get(c.Id).Approved__c){
      // Define parameters to be used in calling Apex Class
      String objectType = 'CDR__c'; // Please change this according to the object type
      String objectId = c.id;
      String projectKey = 'CDR'; //Please change this according to the JIRA project key
      String issueType = '10001';   //Please change this according to the JIRA issue type ID
      // Calls the actual callout to create the JIRA issue.
      JIRAConnectorWebserviceCalloutCreate.createIssue(JIRA.baseUrl, JIRA.systemId, objectType, objectId, projectKey, issueType);

     }
      
    }
  }
  }