Need some help with updating a controller extension test class. I am getting a "method is not visible: test_session_and_session_benefit.testCreateSessions()" error.
This test class is being rewritten from an old version created by another programmer. Here is the test class for the controller extension:
@isTest
public with sharing class TestExt_EmpSessionBenefit {
testMethod static void testEmpSessionBenefit() {
Employee_Session__c employeeSession = Test_Session_and_Session_Benefit.testCreateSessions();
Test.setCurrentPage(Page.SessionBenefit);
ext_EmpSessionBenefit controller = new ext_EmpSessionBenefit(new ApexPages.StandardController(employeeSession));
controller.loadESBs();
pageReference pr = controller.saveChangesNewPage();
controller.reload();
controller.saveChanges();
controller.reload();
pageReference pradmin = controller.saveAdminNewPage();
controller.reload();
controller.saveAdminChanges();
controller.doNothing();
controller.reload();
pagereference prsched = controller.scheduleReview();
controller.reload();
pagereference prAdminTask = controller.assignFollowUpTask();
controller.reload();
}
}
Here is my test class for the trigger on this object. I am trying to use this test class as it does all the work for setting up the accounts, employees, and other needed bits. This is a brand new test class that i have created from scratch.
@isTest
global class Test_Session_and_Session_Benefit {
//Created by Matt - March 2016
//Designed for the Acorn Release
//Create Users, Accounts, Public Groups, Hubs, etc....
//First Employee Session is a Full Benefit Review
//Session Date: 10 months ago on first of month.
@testSetup static void setupTestData(){
//huge chunk of code creating test users,accounts,employees,benefits, etc...
}
//Create Basic Acorn Sessions
@isTest static void testCreateSessions(){
User uBCS = [Select Id,Name FROM User WHERE Alias = 'TSTBCS'];
System.runAs(uBCS){
RecordType RecType = [Select Id from RecordType WHERE Name = 'Standard EE Session - Acorn'];
Employees__c emp = [SELECT Id, Name FROM Employees__c LIMIT 1];
BCS__c theHub = [SELECT Id, Name, User__c FROM BCS__c WHERE User__c = :uBCS.Id];
test.startTest();
List<Employee_Session__c> session = new List<Employee_Session__c>();
//Create Review session - Full Review
Session.add(new Employee_Session__c(
RecordTypeId = RecType.Id,
Employee__c = emp.Id,
Session_Date__c = Date.today().addMonths(-2).toStartOfMonth(),
Specialist__c = theHub.Id,
Intro_with_Compliance_Verbiage__c = TRUE,
Core__c = TRUE,
Voluntary_Benefits__c = TRUE,
Conclusion__c = TRUE
));
//Create Service Session
session.add(new Employee_Session__c(
RecordTypeId = RecType.Id,
Employee__c = emp.Id,
Session_Date__c = Date.today().addMonths(-2).toStartOfMonth(),
Specialist__c = theHub.Id,
Session_Status__c = 'Service',
Session_Type__c = 'Service',
Intro_with_Compliance_Verbiage__c = TRUE
));
//Create Refused Review
session.add(new Employee_Session__c(
RecordTypeId = RecType.Id,
Employee__c = emp.Id,
Session_Date__c = Date.today().addMonths(-2).toStartOfMonth(),
Specialist__c = theHub.Id,
EE_Refused_Review__c = TRUE
));
try {
insert session;
} catch(DmlException e) {
System.debug('The following exception has occurred: ' + e.getMessage());
}
//system.debug('Sessions = ' + session);
//Enroll in all benefits for session.
List<Employee_Session_Benefit__c> sessionBenefit = new List<Employee_Session_Benefit__c>();
sessionBenefit = [SELECT Id, Name, Employee_Session__c, Election_Status__c, Premium__c FROM Employee_Session_Benefit__c];
for( Employee_Session_Benefit__c sb:sessionBenefit){
sb.Election_Status__c = 'Enrolled - Paper';
sb.Premium__c = 10.00;
//system.debug('sessionBenefit = '+sb.Id+' '+sb.Name+' '+sb.Election_Status__c+' '+sb.Premium__c);
}
try {
update sessionBenefit;
} catch(DmlException e) {
System.debug('The following exception has occurred: ' + e.getMessage());
}
test.stopTest();
}
}
}
In case someone wants to see it here is my visualforce page:
<apex:page standardController="Employee_Session__c" extensions="ext_EmpSessionBenefit">
<br/>
<apex:form id="theForm" >
<apex:pageMessages />
<apex:pageMessages />
<apex:outputPanel id="Success" layout="block" rendered="{!success}">
<apex:pageMessage summary="Success" severity="info" />
<script>
window.top.location='/{!employeeId}';
</script>
</apex:outputPanel>
<apex:outputPanel id="Fail" layout="block" rendered="{!!success}" >
<apex:outputText value="{!errorMessages}" escape="false"/>
</apex:outputPanel>
<apex:outputPanel id="Detail" layout="block" title="Detail">
<apex:pageBlock id="pb_BenUnderReview" title="Benefits Under Admin Review" rendered="{!adminRender}" >
<apex:pageBlockTable id="pbt_myTable_2" value="{!esb_List_review}" var="rev" >
<apex:column headerValue="Account Benefit" >
<apex:outputLink value="/{!rev.Account_Benefit__r.id}" target="_blank">{!rev.Account_Benefit__r.Name}</apex:outputLink>
</apex:column>
<apex:column headerValue="Election Status" >
<apex:inputField value="{!rev.Election_Status__c}" rendered="{!paperRender}" />
<apex:outputText value="{!rev.Election_Status__c}" rendered="{!!paperRender}" />
</apex:column>
<apex:column headerValue="Paper Status" >
<apex:inputField value="{!rev.Paper_Status__c}" rendered="{!paperRender}" />
<apex:outputText value="{!rev.Paper_Status__c}" rendered="{!!paperRender}" />
</apex:column>
<apex:column headerValue="Incomplete Reason" >
<apex:inputField value="{!rev.Incomplete_Reason__c}" rendered="{!incompleteRender}" />
<apex:outputText value="{!rev.Incomplete_Reason__c}" rendered="{!!incompleteRender}" />
</apex:column>
<apex:column headerValue="Per Payroll Premium" >
<apex:inputField value="{!rev.Premium__c}" rendered="{!paperRender}" />
<apex:outputText value="{!rev.Premium__c}" rendered="{!!paperRender}" />
</apex:column>
<apex:column headerValue="Volume" rendered="{!showVolume}">
<apex:inputField value="{!rev.Volume__c}" rendered="{!paperRender && rev.Account_Benefit__r.Show_Volume__c}"/>
<apex:outputText value="{!rev.Volume__c}" rendered="{!!paperRender && rev.Account_Benefit__r.Show_Volume__c}"/>
</apex:column>
<apex:column headerValue="Elimination Period" rendered="{!showEliminationPeriod}" >
<apex:inputField value="{!rev.Elimination_Period__c}" rendered="{!paperRender && rev.Account_Benefit__r.Show_Elimination_Period__c}"/>
<apex:outputText value="{!rev.Elimination_Period__c}" rendered="{!!paperRender && rev.Account_Benefit__r.Show_Elimination_Period__c}"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockButtons id="pbb_save_admin" location="bottom" rendered="{!adminButtons}" >
<apex:commandButton action="{!saveAdminNewPage}" value="Save Admin Changes" />
</apex:pageBlockButtons>
</apex:pageBlock>
<!-- All versus Active Filter -->
<apex:pageBlock id="pb_Ben" title="Benefits" rendered="{!!serviceSession}">
<apex:outputPanel rendered="{!hasGrandfatheredBenefits}" >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputText value="Benefits Filter: " />
<apex:selectList value="{!benefitType}" size="1">
<apex:selectOptions value="{!benefitTypes}" />
<apex:actionSupport event="onchange" action="{!loadESBs}" rerender="Detail" status="status"/>
</apex:selectList>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:outputPanel>
<!-- Active Benefits Section-->
<apex:pageBlockTable id="pbt_myTable" value="{!esb_List}" var="ben" rendered="{!!serviceSession}">
<apex:column style="{!if(ben.Account_Benefit__r.Grandfathered__c = TRUE,'background:#BDB76B;', '')}" >
<apex:facet name="header">Account Benefit</apex:facet>
<apex:outputLink value="/{!ben.Account_Benefit__r.id}" target="_blank">{!ben.Account_Benefit__r.Name}</apex:outputLink>
</apex:column>
<apex:column headerValue="Election Status" style="{!if(ben.Account_Benefit__r.Grandfathered__c = TRUE,'background:#BDB76B;', '')}">
<apex:inputField value="{!ben.Election_Status__c}" rendered="{!!selfServiceSession}"/>
<apex:outputField value="{!ben.Election_Status__c}" rendered="{!selfServiceSession}"/>
</apex:column>
<apex:column headerValue="Paper Status" style="{!if(ben.Account_Benefit__r.Grandfathered__c = TRUE,'background:#BDB76B;', '')}">
<apex:inputField value="{!ben.Paper_Status__c}" rendered="{!paperRender && !selfServiceSession}" />
<apex:outputText value="{!ben.Paper_Status__c}" rendered="{!!paperRender && !!selfServiceSession}" />
</apex:column>
<apex:column headerValue="Incomplete Reason" style="{!if(ben.Account_Benefit__r.Grandfathered__c = TRUE,'background:#BDB76B;', '')}">
<apex:inputField value="{!ben.Incomplete_Reason__c}" rendered="{!incompleteRender && !selfServiceSession}" />
<apex:outputText value="{!ben.Incomplete_Reason__c}" rendered="{!!incompleteRender && !!selfServiceSession}" />
</apex:column>
<apex:column headerValue="Per Payroll Premium" id="Premium" style="{!if(ben.Account_Benefit__r.Grandfathered__c = TRUE,'background:#BDB76B;', '')}">
<apex:inputField value="{!ben.Premium__c}" rendered="{!!selfServiceSession}"/>
<apex:outputText value="{!ben.Premium__c}" rendered="{!selfServiceSession}"/>
</apex:column>
<apex:column headerValue="Volume" rendered="{!showVolume}" style="{!if(ben.Account_Benefit__r.Grandfathered__c = TRUE,'background:#BDB76B;', '')}">
<apex:inputField value="{!ben.Volume__c}" rendered="{!ben.Account_Benefit__r.Show_Volume__c}" />
</apex:column>
<apex:column headerValue="Elimination Period" rendered="{!showEliminationPeriod}" style="{!if(ben.Account_Benefit__r.Grandfathered__c = TRUE,'background:#BDB76B;', '')}">
<apex:inputField value="{!ben.Elimination_Period__c}" rendered="{!ben.Account_Benefit__r.Show_Elimination_Period__c}"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockButtons id="pbb_save" location="bottom" rendered="{!!selfServiceSession}">
<apex:commandButton action="{!saveChangesNewPage}" value="Save Voluntary Info" rendered="{!!serviceSession}"/>
<apex:commandLink action="{!ScheduleReview}" value="Save,Schedule Review" target="_blank" rendered="{!!serviceSession}" styleclass="btn" style="text-decoration:none;" />
<apex:commandLink action="{!assignFollowUpTask}" value="Save,Assign Follow-Up Task" target="_blank" rendered="{!!serviceSession}" styleclass="btn" style="text-decoration:none;" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:outputPanel>
<br/>
<!--Inactive Benefits-->
<apex:outputPanel id="Inactive" layout="block" title="Inactive">
<apex:pageBlock id="pb_Inactive_Ben" title="Inactive Benefits (Reference Only)" rendered="{!inactiveRender}">
<apex:pageBlockTable id="pbt_InactiveBen" value="{!esb_List_inactive}" var="ben" rendered="{!inactiveRender}">
<apex:column headerValue="Account Benefit">
<apex:outputLink value="/{!ben.Account_Benefit__r.id}" target="_blank">{!ben.Account_Benefit__r.Name}</apex:outputLink>
</apex:column>
<apex:column headerValue="Election Status" >
<apex:outputField value="{!ben.Election_Status__c}" rendered="True"/>
</apex:column>
<apex:column headerValue="Paper Status" >
<apex:outputText value="{!ben.Paper_Status__c}" rendered="TRUE" />
</apex:column>
<apex:column headerValue="Incomplete Reason" >
<apex:outputText value="{!ben.Incomplete_Reason__c}" rendered="TRUE" />
</apex:column>
<apex:column headerValue="Per Payroll Premium" >
<apex:outputText value="{!ben.Premium__c}"/>
</apex:column>
<apex:column headerValue="Volume" rendered="TRUE">
<apex:outputText value="{!ben.Volume__c}" rendered="TRUE" />
</apex:column>
<apex:column headerValue="Elimination Period" rendered="TRUE" >
<apex:outputText value="{!ben.Elimination_Period__c}" rendered="TRUE" />
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:outputPanel>
<apex:outputpanel >
<apex:actionstatus id="status">
<apex:facet name="start">
<div class="waitingSearchDiv" id="el_loading" style="background-color: #fbfbfb;
height: 100%;opacity:0.65;width:100%;">
<div class="waitingHolder" style="top: 50px; width: 91px;">
<img class="waitingImage" src="/img/loading.gif" title="Please Wait..." />
<span class="waitingDescription">Please Wait...</span>
</div>
</div>
</apex:facet>
</apex:actionstatus>
</apex:outputpanel>
</apex:form>
</apex:page>