Open mkdir-not-war opened 5 years ago
this is the code we're using to get code coverage:
Id testRecordId = yourParentRecordId;
// instantiate class
yourLightningGridClassName lgMA = new yourLightningGridClassName();
sortablegrid.SDG coreSDG = lgMA.LoadSDG('', testRecordId);
system.assertNotEquals(null, coreSDG);
system.assertNotEquals(0, coreSDG.SDGActions.size());
system.assertNotEquals(0, coreSDG.SDGFields.size());
// create the user request
sortablegrid.SDGRequest request = new sortablegrid.SDGRequest();
request.parentRecordId = testRecordId;
request.pageId = 1;
request.pageSize = 10;
request.SortColumn = '1';
request.SortOrder = 'A';
// get data
result = yourLightningGridClassName.getData(coreSDG, request);
system.assertNotEquals(null, result);
Hello, we have been using your example class as a framework for our own custom data provider classes.
but we are having an issue with getting code coverage. Specifically on the private methods GetFields and GetActions, as well as especially the LoadSDG function, which is non-static. Since the custom class implements the sdgIDataProvider, which is an interface and cannot be instantiated, and since the custom class itself has no constructor, it would stand to reason that only static methods from it could be called. There is no way to instantiate the class, so there is no way to call instance methods. I see you found a creative way around this in your class "sdgDataProviderFactory," but unfortunately that class is not visible to us using the managed package. If you could provide some insight on how to call the LoadSDG function in your own example, it would greatly help us do the same in our own. Thanks.