You need to sign in to do that
Don't have an account?
tina sharma 10
How to write test class code
I am new to writing test classes in salesforce.
I require urgent help.
I request some one to please let me know how to write 100% code coverage for the following apex class.
public with sharing class MyClass
{
@AuraEnabled
public static void storeSomeData(Object records){
Cache.SessionPartition sessionPartition = Cache.Session.getPartition('local.OrgLinks1);
try{
Cache.Session.put('local.OrgLinks1.SomeData', records);
}
catch(Exception e)
{
system.debug('cache failed');
}
}
@AuraEnabled
public static Object getMyData(){
Object someRecords;
Cache.SessionPartition sessionPartition = Cache.Session.getPartition('local.OrgLinks1');
try{
if (sessionPartition.contains('SomeData')) {
someRecords= (Object)sessionPartition.get('SomeData');
}
}
catch(Exception e)
{
system.debug('cache failed');
}
return someRecords;
}
}
}
Please let me know.
Thanks
Tina
I require urgent help.
I request some one to please let me know how to write 100% code coverage for the following apex class.
public with sharing class MyClass
{
@AuraEnabled
public static void storeSomeData(Object records){
Cache.SessionPartition sessionPartition = Cache.Session.getPartition('local.OrgLinks1);
try{
Cache.Session.put('local.OrgLinks1.SomeData', records);
}
catch(Exception e)
{
system.debug('cache failed');
}
}
@AuraEnabled
public static Object getMyData(){
Object someRecords;
Cache.SessionPartition sessionPartition = Cache.Session.getPartition('local.OrgLinks1');
try{
if (sessionPartition.contains('SomeData')) {
someRecords= (Object)sessionPartition.get('SomeData');
}
}
catch(Exception e)
{
system.debug('cache failed');
}
return someRecords;
}
}
}
Please let me know.
Thanks
Tina
i will suggent what ever you have written so far as test class you should post that too
@isTest
public class MyClassTestClass
{
static testMethod void testmethod1()
{
Object obj = MyClass.getMyData();
MyClass.storeSomeData(obj);
}
}