{"action":"created","issue":{"url":"https://api.github.com/repos/noeticpenguin/Custom-Related-Lists/issues/4","repository_url":"https://api.github.com/repos/noeticpenguin/Custom-Related-Lists","labels_url":"https://api.github.com/repos/noeticpenguin/Custom-Related-Lists/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/noeticpenguin/Custom-Related-Lists/issues/4/comments","events_url":"https://api.github.com/repos/noeticpenguin/Custom-Related-Lists/issues/4/events","html_url":"https://github.com/noeticpenguin/Custom-Related-Lists/issues/4","id":82278108,"number":4,"title":"Generated test class doesn't pass","user":{"login":"tet3","id":1319826,"avatar_url":"https://avatars.githubusercontent.com/u/1319826?v=3","gravatar_id":"","url":"https://api.github.com/users/tet3","html_url":"https://github.com/tet3","followers_url":"https://api.github.com/users/tet3/followers","following_url":"https://api.github.com/users/tet3/following{/other_user}","gists_url":"https://api.github.com/users/tet3/gists{/gist_id}","starred_url":"https://api.github.com/users/tet3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tet3/subscriptions","organizations_url":"https://api.github.com/users/tet3/orgs","repos_url":"https://api.github.com/users/tet3/repos","events_url":"https://api.github.com/users/tet3/events{/privacy}","received_events_url":"https://api.github.com/users/tet3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-29T05:51:59Z","updated_at":"2016-04-13T16:28:59Z","closed_at":null,"body":"The getFilteredList() method of my generated test method is consistently failing:\r\n\r\n```apex\r\n\t@isTest static void Test_getFilteredList() {\r\n\t\tRelated_list__c rl = generateRelatedListAndInsert();\r\n\t\tContact masterObject = (Contact)TestFactory.createSObject(new Contact());\r\n\t\tinsert masterObject;\r\n\t\tList<rC_Bios__Preference__c> detailObjects = (List<rC_Bios__Preference__c>)TestFactory.createSObjectList(new rC_Bios__Preference__c(rC_Bios__Contact__c = masterObject.id), 5);\r\n\t\tinsert detailObjects;\r\n\t\tApexPages.StandardController sc = new ApexPages.StandardController(masterObject);\r\n\t\tCRL_Controller00001 ctrl = new CRL_Controller00001(sc, rl.id);\r\n\t\tTest.startTest();\r\n\t\tList<rC_Bios__Preference__c> results = ctrl.getFilteredList();\r\n\t\tTest.stopTest();\r\n\r\n\t\tSystem.assertEquals(5, results.size());\r\n\t}\r\n```\r\n\r\nThe problem is that the related records (`rC_Bios__Preference__c` in this case) are created without defining any field values that will include them in the filter, but then the filter is run against them, and when none match, the assertion fails. \r\n\r\nThe specific one-field filter that I have would make it relatively easy to create a default values class for the related object that would cause the generated records to be included in the filter. But doing that generically for all the offered filter criteria seems, uh, challenging. Commenting out the assert allows the test to pass and provide coverage of the getFilteredList() function."},"comment":{"url":"https://api.github.com/repos/noeticpenguin/Custom-Related-Lists/issues/comments/209532520","html_url":"https://github.com/noeticpenguin/Custom-Related-Lists/issues/4#issuecomment-209532520","issue_url":"https://api.github.com/repos/noeticpenguin/Custom-Related-Lists/issues/4","id":209532520,"user":{"login":"JimBTek","id":1176347,"avatar_url":"https://avatars.githubusercontent.com/u/1176347?v=3","gravatar_id":"","url":"https://api.github.com/users/JimBTek","html_url":"https://github.com/JimBTek","followers_url":"https://api.github.com/users/JimBTek/followers","following_url":"https://api.github.com/users/JimBTek/following{/other_user}","gists_url":"https://api.github.com/users/JimBTek/gists{/gist_id}","starred_url":"https://api.github.com/users/JimBTek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JimBTek/subscriptions","organizations_url":"https://api.github.com/users/JimBTek/orgs","repos_url":"https://api.github.com/users/JimBTek/repos","events_url":"https://api.github.com/users/JimBTek/events{/privacy}","received_events_url":"https://api.github.com/users/JimBTek/received_events","type":"User","site_admin":false},"created_at":"2016-04-13T16:28:59Z","updated_at":"2016-04-13T16:28:59Z","body":"I am also seeing this where the Test fails on Assertion because the criteria stored in rl.Criteria__c are not being included in the test factory\r\n"}}