You need to sign in to do that
Don't have an account?
ItsMeSol
Test class
What would be the text class of this
public static void ProdMeetNull (Item__c[] ProdMeetBlank ){
for (Item__c I :ProdMeetBlank){
if (I.product_meeting__c != null && I.Request_Rejected__c== True && I.Request_Approved__c == False) {
I.Product_Meeting__c = null;
}
}
}
Hi
create list of items first in test class and call this method parameters
public class testclass{
List <Item> ltList = new List<Item>();
for(Integer i=0 ; i<10; i++) {
item i1 = new item(name = 'iyem'+i, required field for inserting);
ltList.add(i1);
}
insert liList;
className.prodMettNull(ltList);
}
this is my tets class but still its zero%. I am new in salesforce programming.
Item__c Itm = New Item__c();
Itm.product_meeting__c='a0bW0000000Dt77';
Itm.Request_Rejected__c = True;
Itm.Request_Approved__c = False;
Itm.Project_Name__c = 'a0RW0000000225n';
Itm.Status__c= 'Draft';
Itm.Item__c = 'Simulation';
Itm.Final_SKU__c = 'TEST Only';
Itm.Decision__c= 'Approved';
Itm.Plant__c = 'a0XW0000000I30V';
Test.startTest();
try {
Database.insert(Itm);
} catch(DMLException e)
{
}
System.assertEquals(false, Itm.product_meeting__c == null);
Test.stopTest();
//Item__c ItemTest = [SELECT id,product_meeting__c FROM Item__c WHERE id = :Itm.product_meeting__c ALL ROWS];
//System.assertNotEquals(ItemTest.product_meeting__c, null);
// System.assert(e.getMessage().contains('Blank'));
}