You need to sign in to do that
Don't have an account?
Shubhangi Jadhav
How to cover test class using Picklist entry with Scema
global class GetPickValuesExitWH implements vlocity_cmt.VlocityOpenInterface2 {
Object wareHouseName ='';
Object wareHouseIdTask='';
global Object invokeMethod(String methodName, Map < String, Object > inputMap, Map < String, Object > outMap,Map < String, Object > options)
{
if (String.isNotBlank(methodName) && methodName.equalsIgnoreCase('GetPicklistValueExitWH'))
{
set<String> pickListValuesList= new set<String>();
Schema.DescribeFieldResult fieldResult = Order.Tet_Exit_Warehouse__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for( Schema.PicklistEntry pickListVal : ple)
{
pickListValuesList.add(pickListVal.getLabel());
}
outmap.put('PicklistValues',pickListValuesList);
return pickListValuesList;
}
if (String.isNotBlank(methodName) && methodName.equalsIgnoreCase('GetPicklistValueForPacking'))
{ String wareHouseId = (string)inputMap.get('WareHouseId');
String wareHouseNameTask = (string)inputMap.get('WareHouseName');
List<Map<String,String>> values = new List<Map<String,String>>();
for(Schema.PicklistEntry e : Order.Tet_Exit_Warehouse__c.getDescribe().getPicklistValues()) {
String value = e.getValue();
String label = e.getLabel();
if(value == wareHouseId )
{
wareHouseName = (Object)label ;
break;
}
if(label== wareHouseNameTask)
{
wareHouseIdTask=(Object)value;
break;
}
}
outMap.put('wareHouseName', wareHouseName);
outMap.put('wareHouseId', wareHouseIdTask);
}
return null;
}
}
Object wareHouseName ='';
Object wareHouseIdTask='';
global Object invokeMethod(String methodName, Map < String, Object > inputMap, Map < String, Object > outMap,Map < String, Object > options)
{
if (String.isNotBlank(methodName) && methodName.equalsIgnoreCase('GetPicklistValueExitWH'))
{
set<String> pickListValuesList= new set<String>();
Schema.DescribeFieldResult fieldResult = Order.Tet_Exit_Warehouse__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for( Schema.PicklistEntry pickListVal : ple)
{
pickListValuesList.add(pickListVal.getLabel());
}
outmap.put('PicklistValues',pickListValuesList);
return pickListValuesList;
}
if (String.isNotBlank(methodName) && methodName.equalsIgnoreCase('GetPicklistValueForPacking'))
{ String wareHouseId = (string)inputMap.get('WareHouseId');
String wareHouseNameTask = (string)inputMap.get('WareHouseName');
List<Map<String,String>> values = new List<Map<String,String>>();
for(Schema.PicklistEntry e : Order.Tet_Exit_Warehouse__c.getDescribe().getPicklistValues()) {
String value = e.getValue();
String label = e.getLabel();
if(value == wareHouseId )
{
wareHouseName = (Object)label ;
break;
}
if(label== wareHouseNameTask)
{
wareHouseIdTask=(Object)value;
break;
}
}
outMap.put('wareHouseName', wareHouseName);
outMap.put('wareHouseId', wareHouseIdTask);
}
return null;
}
}
If you just invoke the method by populating the respective maps with valid values.. that'll cover the portion .tb_button {padding:1px;cursor:pointer;border-right: 1px solid #8b8b8b;border-left: 1px solid #FFF;border-bottom: 1px solid #fff;}.tb_button.hover {borer:2px outset #def; background-color: #f8f8f8 !important;}.ws_toolbar {z-index:100000} .ws_toolbar .ws_tb_btn {cursor:pointer;border:1px solid #555;padding:3px} .tb_highlight{background-color:yellow} .tb_hide {visibility:hidden} .ws_toolbar img {padding:2px;margin:0px}