I'm currently updating a lot of my unit tests to get a healthy average above 75% for some wiggle room. The controller I am currently testing on has a SOQL query within the method I am testing.
try {
List<PreferredConstituentInfos__x> pis = [select
consType__c,
constituent_id__c,
title__c,
first_name__c,
middle_name__c,
........
phoneType__c
from
PreferredConstituentInfos__x
where
constituent_id__c = :currCase.ConstituentID__c];
Within my unit test I am trying to force fake values into this query when the test runs. That way it will go within the next if statement:
if (pis.size() == 1) {
Does this require a mock method within the test class? Or is there a way to inject the values into the controller during the test run? I'm pretty new to test classes and I inherited this code I'm trying to test. So trying to see the whole picture and write unit test from scratch is challenging.