You need to sign in to do that
Don't have an account?
test class coverage is 57 percent ,How can i increase please help me on this
Test class:
/*
* @description - This class is the test class for WOD_ProjectTriggerHandler,WOD_BusinessRules_ACK_DOC_Helper and WOD_ProjectDataService
*/
@isTest
public with sharing class WOD_ProjectTriggerHandlerTest {
public WOD_ProjectTriggerHandlerTest() {
}
@testSetup
public static void runTestSetup(){
Test.startTest();
WOD_DataFactoryTest.createAckBusinessRule();
WOD_DataFactoryTest.createDocumentBusinessRule();
twod_bm__Project__c project = WOD_DataFactoryTest.createProject();
project.twod_bm__Project_Status__c = 'Submitted';
project.twod_bm__Is_Migrated_Data__c = true;
// update project;
// Adding Strategic Account also
Account acc = WOD_DataFactoryTest.createAccount();
acc.twod_bm__Strategic_Account__c = true;
update acc;
WOD_2__Inventory__c inventory = WOD_DataFactoryTest.createInventory(project.Id);
inventory.twod_bm__Inventory_Status__c = 'Pending Review';
inventory.twod_bm__Guarantee_Issued__c = false;
inventory.twod_bm__Strategic_Building__c = true;
inventory.twod_bm__Strategic_AccountName__c = acc.id;
inventory.twod_bm__Strategic_Price_Available__c = true;
update inventory;
WOD_2__Inventory__c inv = WOD_DataFactoryTest.createInventory(project.Id);
inv.twod_bm__Guarantee_Issued__c = true;
inv.twod_bm__Admin_Review__c = true;
inv.twod_bm__Specification_Check__c = true;
inv.twod_bm__Is_Building_Approved__c = true;
update inv;
twod_bm__Inspection__c ins = WOD_DataFactoryTest.createInspection(inv.id);
ins.twod_bm__Type__c = 'Final Inspection';
ins.twod_bm__Status__c = 'Pending Inspection';
ins.twod_bm__Inspection_Rating__c = 'Conditionally accepted with Punchlist';
update ins;
twod_bm__Customer_Communication__c custComm = new twod_bm__Customer_Communication__c();
custComm.twod_bm__Building__c = inventory.id;
custComm.twod_bm__Status__c = 'Awaiting Response';
//insert custComm;
WOD_2__Warranty_Registration__c objwarranty= WOD_DataFactoryTest.createWarrantyRegistration(inventory.id);
Test.stopTest();
}
@IsTest
static void handlerMethods(){
test.startTest();
Account acc = new Account();
acc.Name = 'Test Property Owner';
// insert acc;
twod_bm__Project__c proj = WOD_DataFactoryTest.createProject();
WOD_2__Inventory__c inv = WOD_DataFactoryTest.createInventory(proj.Id);
WOD_2__Warranty_Registration__c objwarranty= WOD_DataFactoryTest.createWarrantyRegistration(inv.id);
Assembly__c ass = WOD_DataFactoryTest.createAssembly(inv.Id);
WOD_DataFactoryTest.createAssemblydetail(ass.Id);
proj.twod_bm__Property_Owner__c = acc.Id;
proj.twod_bm__Submitted_Internally__c = true;
proj.twod_bm__Project_Status__c = 'Submitted';
// update proj;
proj.twod_bm__General_Contractor__c = acc.Id;
// update proj;
WOD_ProjectTriggerHandler.createOpenItems(new List<twod_bm__Project__c>{proj});
test.stopTest();
}
@IsTest
static void handlerMethodsForDelete(){
test.startTest();
Account acc = new Account();
acc.Name = 'Test Property Owner';
//insert acc;
twod_bm__Project__c proj = WOD_DataFactoryTest.createProject();
WOD_2__Inventory__c inv = WOD_DataFactoryTest.createInventory(proj.Id);
WOD_2__Warranty_Registration__c objwarranty= WOD_DataFactoryTest.createWarrantyRegistration(inv.id);
Assembly__c ass = WOD_DataFactoryTest.createAssembly(inv.Id);
WOD_DataFactoryTest.createAssemblydetail(ass.Id);
proj.twod_bm__Property_Owner__c = acc.Id;
proj.twod_bm__Submitted_Internally__c = true;
proj.twod_bm__Project_Status__c = 'Submitted';
//update proj;
proj.twod_bm__General_Contractor__c = acc.Id;
// update proj;
delete proj;
test.stopTest();
}
}
Can you share the apex class & which lines covered?
Thanks!!