Hello and thank you for taking the time to read my question. I am getting near the end of finally testing my new trigger, and started to clean up my code. I decided(as recommended by others in this community) to create a separate class that contains methods to fill Accounts, Opportunities and other objects. However, when I call the class and it's method I get the error: Type is not visible
This is my class with the methods described above.
@isTest
public class TestUtil
{
public static Contact initContact(){
/**
* Create a Contact
* Insert Contact into DB
* Return Contact back into testPage in order to use information
**/
Contact testContact = new Contact (
firstName = 'Firstly', lastName = 'Lastly', email = 'test@test.com'
);
insert testContact;
return testContact;
}
My test class calling this:
@isTest
private class Test_Trig_Opportunity_CreateServContract {
static testMethod void testTriggerOpp() {
// Initiliazed Class that contains methods to create SF Objects(Account, Opportunity, etc. )
TestUtil initObj = new TestUtil();
//initialize test variables (called from test variable class)
Contact testContact = initObj.initContact();
I also tried without calling the class at first:
@isTest
private class Test_Trig_Opportunity_CreateServContract {
static testMethod void testTriggerOpp() {
//initialize test variables (called from test variable class)
Contact testContact = TestUtil.initContact();
Both bring the same error. Thank you again for your time.
initContact()look exactly like this? Isn't marked private or with some System.runAs? DidTestUtilsave succesfully to server? – eyescream Feb 19 at 21:57