function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
guest1231231guest1231231 

testAccountHierarchy

Recieving this error during deployment that I am not recieving in sandbox?  It is being caused by managed packages.

 

What is wrong here?

 

Failure Message: "System.DmlException: Update failed. First exception on row 0 with id 00100000005gZ8PAAU; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, pw_cc.ValidateAccountCountryFields: execution of BeforeUpdate caused by: System.Exception: pw_cc:Too many query rows: 501 (pw_cc) ", Failure Stack Trace: "Class.Account...

guest1231231guest1231231

 

@isTest
private class testAccountHierarchy {

	static testMethod void testAccountHierarchy() {
		// Instanciate Page

		AccountHierarchyTestData.createTestHierarchy();

		Account topAccount = [Select id, name, website from account where name = 'HierarchyTest0' LIMIT 1];
		Account middleAccount = [Select id, parentID, name from account where name = 'HierarchyTest4' LIMIT 1];
		Account bottomAccount = [Select id, parentID, name from account where name = 'HierarchyTest9' LIMIT 1];
		Account[] accountList = [Select id, parentID, name from account where name like 'HierarchyTest%'];
		
		test.startTest();
		
		try{
			
		System.debug('DEBUG: AccountList size: '+accountList.size());
	
		PageReference AccountHierarchyPage = Page.AccountHierarchyPage;
		Test.setCurrentPage(AccountHierarchyPage);
		ApexPages.currentPage().getParameters().put('id', topAccount.id);
	
		// Instanciate Controller
		AccountStructure controller = new AccountStructure();
		
		// Call Methodes for top account
		controller.setcurrentId(null);
		AccountStructure.ObjectStructureMap[] smt1 = new AccountStructure.ObjectStructureMap[]{};
		smt1 = controller.getObjectStructure();
		System.Assert(smt1.size()>0, 'Test failed at Top account, no Id');

		controller.setcurrentId(String.valueOf(topAccount.id));
		AccountStructure.ObjectStructureMap[] smt2 = new AccountStructure.ObjectStructureMap[]{};
		smt2 = controller.getObjectStructure();
		System.Assert(smt2.size()>0, 'Test failed at Top account, with Id: '+smt2.size());

		//Call ObjectStructureMap methodes
		smt2[0].setnodeId('1234567890');
		smt2[0].setlevelFlag(true);
		smt2[0].setlcloseFlag(false);
		smt2[0].setnodeType('parent');
		smt2[0].setcurrentNode(false);
		smt2[0].setaccount(topAccount);
		String nodeId = smt2[0].getnodeId();
		Boolean[] levelFlag = smt2[0].getlevelFlag();
		Boolean[] closeFlag = smt2[0].getcloseFlag();
		String nodeType = smt2[0].getnodeType();
		Boolean currentName = smt2[0].getcurrentNode();
		Account smbAccount = smt2[0].getaccount();


		// Call Methodes for middle account
		controller.setcurrentId(String.valueOf(middleAccount.id));
		AccountStructure.ObjectStructureMap[] smm = new AccountStructure.ObjectStructureMap[]{};
		smm = controller.getObjectStructure();
		System.Assert(smm.size()>0, 'Test failed at middle account');

		// Call Methodes for bottom account
		controller.setcurrentId(String.valueOf(bottomAccount.id));
		AccountStructure.ObjectStructureMap[] smb = new AccountStructure.ObjectStructureMap[]{};
		smb = controller.getObjectStructure();
		System.Assert(smb.size()>0, 'Test failed at top account');
		
		}
		catch (System.DmlException e){
		}
				
		test.stopTest();
	}

}

 

here is the code

 

emuelasemuelas

Hi,

 

Were you able to solve this issue?  i am also getting the same error.

 

Thanks

Ambily