title: Salesforce Beginner - test class for controller extension
body: <p>I am new to coding and am using Salesforce.
  I need help understanding how to create a test class for a controller extension.
  I am clutching at straws when building the Test Class and now have 66% code coverage. Your help to adjust the below code will be much appreciated and help greatly in my understanding.
  The Visualforce page is very simple:</p>
  <pre><code>&lt;apex:page standardController=&quot;Case&quot; 
      extensions=&quot;Case_ListOppSplits_Controller&quot; lightningStylesheets=&quot;true&quot;&gt;
  &lt;apex:pageBlock &gt;
      &lt;apex:pageBlockTable value=&quot;{!Opportunity_Splits}&quot; var=&quot;oppSplit&quot;&gt;
          &lt;apex:column value=&quot;{!oppSplit.Name}&quot;/&gt;
          &lt;apex:column value=&quot;{!oppSplit.Split_Loan_Amount__c}&quot;/&gt;
          &lt;apex:column value=&quot;{!oppSplit.Loan_Usage__c}&quot;/&gt;
          &lt;apex:column value=&quot;{!oppSplit.Loan_Purpose__c}&quot;/&gt;
          &lt;apex:column value=&quot;{!oppSplit.Rate_Type__c}&quot;/&gt;
          &lt;apex:column value=&quot;{!oppSplit.Repayment_Type__c}&quot;/&gt;
      &lt;/apex:pageBlockTable&gt;
  &lt;/apex:pageBlock&gt;
  &lt;/apex:page&gt;`
  </code></pre>
  <p>The controller extension is:</p>
  <pre><code>public class Case_ListOppSplits_Controller {
      public Case myCase;
  
      public Case_ListOppSplits_Controller(ApexPages.StandardController stdController){
          this.myCase = (Case)stdController.getRecord();
  
      }
      public list&lt;Opportunity_Split__c&gt; getOpportunity_Splits(){
          Case currentCase = [SELECT Id, Subject, Opportunity__c FROM Case WHERE Id =: ApexPages.currentPage().getParameters().get('id')];
          List&lt;Opportunity_Split__c&gt; OppSplits = [SELECT Id, Name, Opportunity__c, Loan_Purpose__c, Loan_Type__c, Loan_Usage__c, Rate_Type__c, Repayment_Type__c, Split_Loan_Amount__c FROM Opportunity_Split__c WHERE Opportunity__c =: currentCase.Opportunity__c];
      return OppSplits;
      }   
  }
  </code></pre>
  <p>Test Class:</p>
  <pre><code>@isTest
  public class Case_ListOppSplits_Controller_Test {
      static testMethod void testMethod1() 
      {
          Case testCase = new Case();
          testCase.Subject='Test Case';
          testCase.Opportunity__c='0067F00000N8vSVQAZ';
          testCase.RecordTypeId='0126D000000qSBcQAM'; //UA
          testCase.Status='Assigned';
          insert testCase;
  
          Test.StartTest(); 
      
          PageReference pageRef = new PageReference('https://omniwealth--dwr.my.salesforce.com/apex/Case_OpportunitySplits?id='+testCase.Id); 
      
          ApexPages.StandardController sc = new ApexPages.StandardController(testCase);
          Case_ListOppSplits_Controller extn = new Case_ListOppSplits_Controller(sc);
          List&lt;Opportunity_Split__c&gt; listOppSplits = extn.getOpportunity_Splits(); 
      
          Test.StopTest();
      }
  }
  </code></pre>