XCode custom segue class stuck
Tag : ios , By : Luciano Campos
Date : March 29 2020, 07:55 AM
will be helpful for those in need The answer is to reset the storyboard target membership, then reset the simulator.
|
I'm stuck on a custom linked list
Date : March 29 2020, 07:55 AM
Hope this helps Your links are not set up correctly. The 99 in link[3] indicates there is no 4th node in the list, only 3.
|
Stuck on a linked list multiple class implementation
Date : March 29 2020, 07:55 AM
Hope that helps Your head member variable of DNAList is initialized with new DNANode. Since DNANode doesn't have an explicit constructor, its compiler generated one will not initialize the pointers data, next and prev. next is initialized on the next line, but data is left as a garbage value. Inside findId, this line is executed: if (current->data->getID() == id){
|
How to test a http calls from a second class func call from within first class (APEX class testing/salesforce testing)
Date : March 29 2020, 07:55 AM
help you fix your problem This is happening because you are not initializing the httpMock class object,so your test class is trying to hit real web service call which is not allowed from test class. What you need to do it to initialize your mockClass object and use it instead to return data rather than hitting real web service endpoint @isTest
global class ResultHttpMock implements HttpCalloutMock {
global HTTPResponse respond(HTTPRequest req) {
HttpResponse res;
System.debug('request inside mock '+req);
if(req != null) {
res = new HttpResponse();
res.setHeader('Content-Type', 'application/json');
res.setBody(getBody());
res.setStatusCode(200);
res.setStatus('OK');
}
return res;
}
private static String getBody() {
String idmJsonMockResponse = '{"ednaScoreCard":{"sc":[],"etr":[{"test":"id:0","details":"false","ts":1471432074763,"stage":"1"},{"test":"ed:37","fired":false,"details":"ed:37(false) = true","ts":1471432074763,"stage":"1"}
}
global class HttpCalloutClass {
public static HttpCalloutMock httpMock = null;
......
if(Test.istestRunning() && httpMock != null) {
Http response = httpMock.respond(request);
} else {
Http response = http.send(request);
}
}
@isTest(seeAllData=false)
public class TestHttp {
static testMethod void testfunctionA() {
Test.startTest();
HttpCalloutClass.httpMock = new ResultHttpMock ();
String result = HttpCalloutClass.functionA();
Test.stopTest();
}
|
Stuck in infinite while loop while printing values from a custom linked list
Date : March 29 2020, 07:55 AM
may help you . Linked-list code usually contains one use of new for each node, and you forgot yours. This means that you were using an uninitialised pointer, which is undefined. void insertFromHead(T data)
{
Node<T> *temp = new Node<T>;
temp->data = data;
temp->next = head;
head = temp;
}
Node(const T& d, Node<T>* n): data(d), next(n) {}
void insertFromHead(const T& data)
{
head = new Node<T>(data, head);
}
|