a strange situation I can't find an example of elsewhere. I have a test class for a batchable apex that is showing in the developer console window as available for code coverage. Haven't seen a test class in there before so I'm wondering if there is an issue with the class. When I run the tests it works as expected and for the relevant classes provides 100% coverage. Unsure of the problem or what could happen when it comes time to deploy.
Thanks!
@isTest
public class UpdateOMSAccountBatchTest
{
private static void createTestData()
{
String orgId = 'testorgid';
String userId = 'testuserid';
String userEmailValid = '[email protected]';
String userEmailInvalid = '[email protected]';
List<Account> account = new List<Account>
{
new Account
(
Name = orgId,
Org_Id__c = orgId
)
};
insert account;
List<Contact> contact = new List<Contact>
{
new Contact
(
AccountId = account[0].Id,
LastName = userId + '_1',
User_Id__c = userId + '_1'
)
};
insert contact;
List<OMS_Organization__c> omsOrganization = new List<OMS_Organization__c>
{
new OMS_Organization__c
(
Name = orgId,
Org_Id__c = orgId,
Organization_Id__c = orgId
)
};
insert omsOrganization;
List<OMS_User__c> omsUser = new List<OMS_User__c>
{
new OMS_User__c
(
OMS_Organization__c = omsOrganization[0].Id,
Name = userId + '_1',
User_Id__c = userId + '_1'
)
};
insert omsUser;
List<OMS_Account__c> omsAccount = new List<OMS_Account__c>
{
new OMS_Account__c
(
OMS_Organization__c = omsOrganization[0].Id,
OMS_User__c = omsUser[0].Id,
Name = userId + '_1',
Account_id__c = '8373635',
Status__c = 'Active'
)
};
insert omsAccount;
}
@isTest static void testLinkAccountToOmsOrganizationByOrgId()
{
createTestData();
UpdateOMSAccountStatusWeekly omsBatch = new UpdateOMSAccountStatusWeekly();
omsBatch.query = 'SELECT Status__c FROM OMS_Account__c WHERE Account_id__c = \'8373635\'';
Database.executebatch(omsBatch);
}
@isTest static void testschedule()
{
Test.StartTest();
UpdateOMSAccountScheduler testsche = new UpdateOMSAccountScheduler();
String sch = '0 0 23 * * ?';
system.schedule('Test status Check', sch, testsche );
Test.stopTest();
}