You need to sign in to do that
Don't have an account?
Michael M
Help with test class for controller
Hello, I need help writing a test class. Here is my class (I am using it as a controller for an aura component).
public class getListViews {
@AuraEnabled
public static List<ListView> getListViews() {
List<ListView> listviews =
[SELECT Id, Name FROM ListView WHERE SobjectType = 'Discharge__c' and Name ='All New Discharges'];
// Perform isAccessible() check here
if (Schema.sObjectType.Discharge__c.isAccessible()){
return listviews;
}
return listviews;
}
}
Can someone please assist in writing test class.
public class getListViews {
@AuraEnabled
public static List<ListView> getListViews() {
List<ListView> listviews =
[SELECT Id, Name FROM ListView WHERE SobjectType = 'Discharge__c' and Name ='All New Discharges'];
// Perform isAccessible() check here
if (Schema.sObjectType.Discharge__c.isAccessible()){
return listviews;
}
return listviews;
}
}
Can someone please assist in writing test class.
Try this:
@isTest
private class getListViewsTest
{
@isTest
static void TestgetListViews()
{
getListViews.getListViews();
}
}
All Answers
Try this:
@isTest
private class getListViewsTest
{
@isTest
static void TestgetListViews()
{
getListViews.getListViews();
}
}