+ Start a Discussion
Nate GriebNate Grieb 

Failing pkb_mobile_Test (Assertion Failed)

I am trying to make a very simple code change to something completely unrelated to the Public Knowledge Base App (third party from app exchange) and I am getting the following error that is preventing me from deploying:

System.AssertException: Assertion Failed
class.pkb_mobile_Test.test_getArticleDetail: line 290, column 1

I checked out the code for this and the whole test looks like so:
//public static pkb_mobile_proxy.ResponseItem getArticleDetail(pkb_mobile_proxy.RequestItem req){
	static void test_getArticleDetail() {
		pkb_mobile_proxy.ResponseItem resp = null;

		//with setup
		PKB__c pkS = populateSetup();
		pkb_Controller.DEFAULT_SITE_NAME = siteName;
		pkb_Controller pc = pkb_mobile_controller.setUp();

		//build request object
		pkb_mobile_proxy.RequestItem req = new pkb_mobile_proxy.RequestItem();
		req.lang = KnowledgeArticleVersion.Language.getDescribe().getPickListValues().get(0).getValue();
		req.operationType = 'getArticleDetail';
		req.sessionId = 'TESTSESSION';
		req.searchCriteria = String.valueOf(kavObj.get('KnowledgeArticleId'));
		resp = pkb_mobile_controller.getArticleDetail(req);
 		Map<String,String> fieldValues = (Map<String,String>)resp.articleData.fieldValues;
 		String kavTitle = String.valueOf(kavObj.get('title'));
 		String resultTitle = resp.articleData.title;
		system.assert( resultTitle.contains(kavtitle));
		//with null request 
		resp = pkb_mobile_controller.getArticleDetail(null);


I have not made any code changes to any of the PKB code, so I have to assume it is something in setup in the UI. Any help would be greatly appreciated. 

ShashankShashank (Salesforce Developers) 
If you have multi-language enabled in your org, there is a known issue being investigated by salesforce R&D and may be fixed in the next version of the Public knowledge base.

Here's a workaround which worked in a specific case, and you might want to give it a try. You may have to make a little modification in the "pkb_mobile_controller" apex class as a workaround to resolve this issue.

There should be a line in the class like below:

Select id,knowledgearticleid,ownerid,isdeleted,title,lastmodifieddate,articlenumber,summary,KnowledgeArticleId from Admissions_Macros__kav WHERE Id = 'ka2550000004CGtAAM' limit 1

You will notice here that knowledgearticleid is mentioned twice in the query. Please try removing one of it and see if it resolves the issue. If that doesn't work, please try commenting out the whole line and see if it helps.
Shivani DesaiShivani Desai
Am facing the same problem. However, I cannot seem to find the line that you mentioned Shashank. I looked through the code thrice atleast. I can email you the code if you would like. Please help as I am unable to deploy my code to production.