0

how to cover global method and class in test class,here is my code

global with sharing class Migration_Asset2PatentBatch implements Database.Batchable<sObject>, Database.AllowsCallouts
{
public string strBatchQuery {get;set;}
public string strBatchResult {get;set;}

global Migration_Asset2PatentBatch()
{
    strBatchQuery = 'SELECT Id, Name, Abstract__c, AIA_First_Inventor_to_File__c, Annual_Annuity_Cost__c, Annual_Others_Cost__c, Annual_Prep_Cost__c, Annual_Prosecution_Cost__c, Application_Number__c, Application_Type__c, Approval_Status__c, Asset_Image__c, Asset_Image_Count__c, Asset_Mapped__c, AssetReferenceNewId__c, Asset_Status__c, Paralegal__c, First_Named_Applicant__c, Attorney__c, Base_Invention_Disclosure__c, SBG__c, SBU__c, Category__c, Claim_Count__c, Class_Subclass__c, ClonedFromAsset__c, Confirmation_Number__c, ContinuityType__c, Correspondence_Address_Customer_Number__c, Country__c, Country_Code__c, Diff_Filing_Date_And_First_OA__c, Diff_Filing_Date_And_Issue_Date__c, Diff_First_OA_And_Closing_Date__c, Docket_No__c, Earliest_Priority_Date__c, Entity_Status__c, Entity_Type__c, EP_PTO_Link__c, Error__c, ExaminationStatus__c, Examiner_Name__c, Expiration_Date__c, Export_Control__c, Family__c, Family_ID__c, Application_Date__c, Filing_or_371_c_Date__c, First_Filing__c, First_Named_Inventor__c, ForeignFilingTrans__c, Government_contract__c, GrandTotal__c, Group_Art_Unit__c, In_house_Attorney__c, International_Reg_Number_Hague__c, International_Reg_Publication_Date__c, Invention_Disclosure__c, Inventors__c, IPC__c, Is_Questel__c, Issue_Date_of_Patent__c, Law_Firm_Agent__c, LinkToPTO__c, Location__c, Location_Date__c, nContract_Associated__c, nID_Associated__c, nPatent_Associated__c, nProduct_Associated__c, nTrademark_Associated__c, Notes__c, OC_BillingNumbers__c, Attorney_Docket_Number__c, Outside_Counsel__c, PatPubAppNo__c, Patent_Number__c, Patent_Group__c, PatentNo_NoKindCode__c, Patent_Not_Expired__c, Patent_Status__c, Patent_Type__c, PKICertificateCustomer__c, Portfolio__c, SBP__c, Previous_Owner__c, Primary_Inventor__c, Priority_Date__c, Priority_Dates__c, Priority_Number__c, Product__c, Expiry_Date__c, Status__c, Status_Date__c, PTO_Link__c, Earliest_Publication_Date__c, Earliest_Publication_No__c, Earliest_Publication_No_NoKindCode__c, Region__c, Remarks__c, Description__c, StatusChangeTime__c, StatusChangeTimeDraftCompletion__c, Term_Date__c, Title_of_Invention__c, Hyperlink__c, TotalFilingcost__c, TotalLifetimecost__c, TotalMaxValAmount__c, Total_RCEX__c, US_PTO_Link__c, OwnerId  FROM Asset__c ORDER BY CreatedDate' ;
}
global Migration_Asset2PatentBatch(Id AssetId)
{
    strBatchQuery = 'SELECT Id, Name, Abstract__c, AIA_First_Inventor_to_File__c, Annual_Annuity_Cost__c, Annual_Others_Cost__c, Annual_Prep_Cost__c, Annual_Prosecution_Cost__c, Application_Number__c, Application_Type__c, Approval_Status__c, Asset_Image__c, Asset_Image_Count__c, Asset_Mapped__c, AssetReferenceNewId__c, Asset_Status__c, Paralegal__c, First_Named_Applicant__c, Attorney__c, Base_Invention_Disclosure__c, SBG__c, SBU__c, Category__c, Claim_Count__c, Class_Subclass__c, ClonedFromAsset__c, Confirmation_Number__c, ContinuityType__c, Correspondence_Address_Customer_Number__c, Country__c, Country_Code__c, Diff_Filing_Date_And_First_OA__c, Diff_Filing_Date_And_Issue_Date__c, Diff_First_OA_And_Closing_Date__c, Docket_No__c, Earliest_Priority_Date__c, Entity_Status__c, Entity_Type__c, EP_PTO_Link__c, Error__c, ExaminationStatus__c, Examiner_Name__c, Expiration_Date__c, Export_Control__c, Family__c, Family_ID__c, Application_Date__c, Filing_or_371_c_Date__c, First_Filing__c, First_Named_Inventor__c, ForeignFilingTrans__c, Government_contract__c, GrandTotal__c, Group_Art_Unit__c, In_house_Attorney__c, International_Reg_Number_Hague__c, International_Reg_Publication_Date__c, Invention_Disclosure__c, Inventors__c, IPC__c, Is_Questel__c, Issue_Date_of_Patent__c, Law_Firm_Agent__c, LinkToPTO__c, Location__c, Location_Date__c, nContract_Associated__c, nID_Associated__c, nPatent_Associated__c, nProduct_Associated__c, nTrademark_Associated__c, Notes__c, OC_BillingNumbers__c, Attorney_Docket_Number__c, Outside_Counsel__c, PatPubAppNo__c, Patent_Number__c, Patent_Group__c, PatentNo_NoKindCode__c, Patent_Not_Expired__c, Patent_Status__c, Patent_Type__c, PKICertificateCustomer__c, Portfolio__c, SBP__c, Previous_Owner__c, Primary_Inventor__c, Priority_Date__c, Priority_Dates__c, Priority_Number__c, Product__c, Expiry_Date__c, Status__c, Status_Date__c, PTO_Link__c, Earliest_Publication_Date__c, Earliest_Publication_No__c, Earliest_Publication_No_NoKindCode__c, Region__c, Remarks__c, Description__c, StatusChangeTime__c, StatusChangeTimeDraftCompletion__c, Term_Date__c, Title_of_Invention__c, Hyperlink__c, TotalFilingcost__c, TotalLifetimecost__c, TotalMaxValAmount__c, Total_RCEX__c, US_PTO_Link__c, OwnerId  FROM Asset__c WHERE Id IN (\'' + AssetId +'\') ORDER BY CreatedDate';
}
global Database.QueryLocator start(Database.BatchableContext BC)
{
    if(Schema.sObjectType.Patent__c.isAccessible()) 
        return Database.getQueryLocator(strBatchQuery);
    else
        return null;
}
global void execute(Database.BatchableContext BC, List<sObject> objScopeObjectList)
{
    if(Schema.sObjectType.Asset__c.isAccessible())
    {
        List<Asset__c> objAssets = new List<Asset__c>();
        for(sObject objScopeObject : objScopeObjectList)
        {
            Asset__c objAsset = (Asset__c)objScopeObject;
            objAssets.add(objAsset);
        }
        if(Schema.sObjectType.Asset__c.isAccessible() && Schema.sObjectType.Asset__c.isUpdateable() && Schema.sObjectType.Asset__c.isCreateable())
        {
            Migrate(objAssets);
        }
    }
}
global void Migrate(List<Asset__c> objAssetList)
{
    string AuditTrailStatus = 'Success';
    string strAuditTrailLogText = '[Started]';
    try 
    {
        List<Patent__c> objPatentList =  new List<Patent__c>();
        for(Asset__c objAsset : objAssetList)
        {
            Patent__c objPatent = new Patent__c();
            objPatent.AIA_First_Inventor_to_File__c = objAsset.AIA_First_Inventor_to_File__c;
            //objPatent.Annual_Annuity_Cost__c = objAsset.Annual_Annuity_Cost__c;//Formula Field
            //objPatent.Annual_Others_Cost__c = objAsset.Annual_Others_Cost__c;//Formula Field
            //objPatent.Annual_Prep_Cost__c = objAsset.Annual_Prep_Cost__c;//Formula Field
            //objPatent.Annual_Prosecution_Cost__c = objAsset.Annual_Prosecution_Cost__c;//Formula Field
            objPatent.Annuity_Status__c = '';
            objPatent.Application_Number__c = objAsset.Application_Number__c;
            objPatent.Application_Type__c = objAsset.Application_Type__c;
            objPatent.Approval_Status__c = objAsset.Approval_Status__c;
            objPatent.Asset_Image__c = objAsset.Asset_Image__c;
            objPatent.Asset_Image_Count__c = objAsset.Asset_Image_Count__c;
            objPatent.Asset_Mapped__c = objAsset.Asset_Mapped__c;
            objPatent.AssetReferenceNewId__c = objAsset.AssetReferenceNewId__c;
            objPatent.Asset_Status__c = objAsset.Asset_Status__c;
            objPatent.Paralegal__c = objAsset.Paralegal__c;
            objPatent.First_Named_Applicant__c = objAsset.First_Named_Applicant__c;
            objPatent.Attorney__c = objAsset.Attorney__c;
            objPatent.Base_Invention_Disclosure__c = objAsset.Base_Invention_Disclosure__c;
            objPatent.SBG__c = objAsset.SBG__c;
            objPatent.SBU__c = objAsset.SBU__c;
            objPatent.Category__c = objAsset.Category__c;
            objPatent.Claim_Count__c = objAsset.Claim_Count__c;
            objPatent.Annuities_All_Claim_Clount__c = 0;
            objPatent.Class_Subclass__c = objAsset.Class_Subclass__c;
            objPatent.ClonedFromAsset__c = objAsset.ClonedFromAsset__c;
            objPatent.Confirmation_Number__c = objAsset.Confirmation_Number__c;
            objPatent.ContinuityType__c = objAsset.ContinuityType__c;
            objPatent.Correspondence_Address_Customer_Number__c = objAsset.Correspondence_Address_Customer_Number__c;
            objPatent.Country__c = objAsset.Country__c;
            objPatent.Country_Code__c = objAsset.Country_Code__c;
            objPatent.Diff_Filing_Date_And_First_OA__c = objAsset.Diff_Filing_Date_And_First_OA__c;
            objPatent.Diff_Filing_Date_And_Issue_Date__c = objAsset.Diff_Filing_Date_And_Issue_Date__c;
            objPatent.Diff_First_OA_And_Closing_Date__c = objAsset.Diff_First_OA_And_Closing_Date__c;
            objPatent.Docket_No__c = objAsset.Docket_No__c;
            objPatent.Earliest_Priority_Date__c = objAsset.Earliest_Priority_Date__c;
            objPatent.Entity_Status__c = objAsset.Entity_Status__c;
            objPatent.Entity_Type__c = objAsset.Entity_Type__c;
            objPatent.EP_PTO_Link__c = objAsset.EP_PTO_Link__c;
            objPatent.Error__c = objAsset.Error__c;
            objPatent.ExaminationStatus__c = objAsset.ExaminationStatus__c;
            objPatent.Examiner_Name__c = objAsset.Examiner_Name__c;
            objPatent.Expiration_Date__c = objAsset.Expiration_Date__c;
            objPatent.Export_Control__c = objAsset.Export_Control__c;
            objPatent.Family__c = objAsset.Family__c;
            objPatent.Family_ID__c = objAsset.Family_ID__c;
            objPatent.Annuities_Fields_Imported__c = true;
            objPatent.Application_Date__c = objAsset.Application_Date__c;
            objPatent.Annuities_Application_Date__c = objAsset.Application_Date__c;
            objPatent.Filing_or_371_c_Date__c = objAsset.Filing_or_371_c_Date__c;
            //objPatent.First_Filing__c = objAsset.First_Filing__c;//Formula Field
            objPatent.First_Named_Inventor__c = objAsset.First_Named_Inventor__c;
            objPatent.ForeignFilingTrans__c = objAsset.ForeignFilingTrans__c;
            //objPatent.ForeignFilingTrans_v1__c = objAsset.ForeignFilingTrans_v1__c;//LOOKUP
            objPatent.Government_contract__c = objAsset.Government_contract__c;
            //objPatent.GrandTotal__c = objAsset.GrandTotal__c;//Formula Field
            objPatent.Group_Art_Unit__c = objAsset.Group_Art_Unit__c;
            objPatent.Annuities_Independent_Claim_Clount__c = 0;
            objPatent.In_house_Attorney__c = objAsset.In_house_Attorney__c;
            objPatent.International_Reg_Number_Hague__c = objAsset.International_Reg_Number_Hague__c;
            objPatent.International_Reg_Publication_Date__c = objAsset.International_Reg_Publication_Date__c;
            objPatent.Invention_Disclosure__c = objAsset.Invention_Disclosure__c;
            objPatent.Inventors__c = objAsset.Inventors__c;
            objPatent.IPC__c = objAsset.IPC__c;
            objPatent.Is_Questel__c = objAsset.Is_Questel__c;
            objPatent.Annuities_Issue_Date_of_Patent__c = objAsset.Issue_Date_of_Patent__c;
            objPatent.Issue_Date_of_Patent__c = objAsset.Issue_Date_of_Patent__c;
            objPatent.Law_Firm_Agent__c = objAsset.Law_Firm_Agent__c;
            objPatent.LinkToPTO__c = objAsset.LinkToPTO__c;
            objPatent.Location__c = objAsset.Location__c;
            objPatent.Location_Date__c = objAsset.Location_Date__c;
            objPatent.nContract_Associated__c = objAsset.nContract_Associated__c;
            objPatent.nID_Associated__c = objAsset.nID_Associated__c;
            objPatent.nPatent_Associated__c = objAsset.nPatent_Associated__c;
            objPatent.nProduct_Associated__c = objAsset.nProduct_Associated__c;
            objPatent.nTrademark_Associated__c = objAsset.nTrademark_Associated__c;
            objPatent.Notes__c = objAsset.Notes__c;
            objPatent.OC_BillingNumbers__c = objAsset.OC_BillingNumbers__c;
            objPatent.Attorney_Docket_Number__c = objAsset.Attorney_Docket_Number__c;
            objPatent.OldAssetId__c = objAsset.Id;
            objPatent.Outside_Counsel__c = objAsset.Outside_Counsel__c;
            //objPatent.PatPubAppNo__c = objAsset.PatPubAppNo__c;//Formula Field
            objPatent.Patent_Number__c = objAsset.Patent_Number__c;
            objPatent.Patent_Group__c = objAsset.Patent_Group__c;
            objPatent.PatentNo_NoKindCode__c = objAsset.PatentNo_NoKindCode__c;
            //objPatent.Patent_Not_Expired__c = objAsset.Patent_Not_Expired__c;//Formula Field
            objPatent.Patent_Status__c = objAsset.Patent_Status__c;
            objPatent.Patent_Type__c = objAsset.Patent_Type__c;
            objPatent.Annuities_PCTFiling_Date__c = objAsset.Application_Date__c;
            objPatent.PKICertificateCustomer__c = objAsset.PKICertificateCustomer__c;
            objPatent.Portfolio__c = objAsset.Portfolio__c;
            objPatent.SBP__c = objAsset.SBP__c;
            objPatent.Previous_Owner__c = objAsset.Previous_Owner__c;
            objPatent.Primary_Inventor__c = objAsset.Primary_Inventor__c;
            objPatent.Priority_Date__c = objAsset.Priority_Date__c;
            objPatent.Priority_Dates__c = objAsset.Priority_Dates__c;
            objPatent.Priority_Number__c = objAsset.Priority_Number__c;
            objPatent.Product__c = objAsset.Product__c;
            //objPatent.Expiry_Date__c = objAsset.Expiry_Date__c;//Formula Field
            objPatent.Status__c = objAsset.Status__c;
            objPatent.Status_Date__c = objAsset.Status_Date__c;
            objPatent.PTO_Link__c = objAsset.PTO_Link__c;
            objPatent.Earliest_Publication_Date__c = objAsset.Earliest_Publication_Date__c;
            objPatent.Earliest_Publication_No__c = objAsset.Earliest_Publication_No__c;
            objPatent.Earliest_Publication_No_NoKindCode__c = objAsset.Earliest_Publication_No_NoKindCode__c;
            objPatent.Region__c = objAsset.Region__c;
            objPatent.Remarks__c = objAsset.Remarks__c;
            objPatent.Description__c = objAsset.Description__c;
            objPatent.StatusChangeTime__c = objAsset.StatusChangeTime__c;
            objPatent.StatusChangeTimeDraftCompletion__c = objAsset.StatusChangeTimeDraftCompletion__c;
            //objPatent.Temporary_Docket_No__c = objAsset.Temporary_Docket_No__c;//Formula Field
            objPatent.Term_Date__c = objAsset.Term_Date__c;
            objPatent.Title_of_Invention__c = objAsset.Title_of_Invention__c;
            //objPatent.Hyperlink__c = objAsset.Hyperlink__c;//Formula Field
            //objPatent.TotalFilingcost__c = objAsset.TotalFilingcost__c;//Formula Field
            //objPatent.TotalLifetimecost__c = objAsset.TotalLifetimecost__c;//Formula Field
            //objPatent.TotalMaxValAmount__c = objAsset.TotalMaxValAmount__c;//Formual Field
            //objPatent.Total_RCEX__c = objAsset.Total_RCEX__c;//Formula Field
            objPatent.US_PTO_Link__c = objAsset.US_PTO_Link__c;
            objPatent.OWNERID = objAsset.OWNERID;
            //objPatent.ISDELETED = objAsset.ISDELETED;
            //objPatent.CREATEDDATE = objAsset.CREATEDDATE;
            //objPatent.CREATEDBYID = objAsset.CREATEDBYID;
            //objPatent.LASTMODIFIEDDATE = objAsset.LASTMODIFIEDDATE;
            //objPatent.LASTMODIFIEDBYID = objAsset.LASTMODIFIEDBYID;
            //objPatent.SYSTEMMODSTAMP = objAsset.SYSTEMMODSTAMP;
            //objPatent.LASTACTIVITYDATE = objAsset.LASTACTIVITYDATE;
            //objPatent.LASTVIEWEDDATE = objAsset.LASTVIEWEDDATE;
            //objPatent.LASTREFERENCEDDATE = objAsset.LASTREFERENCEDDATE;
            objPatentList.add(objPatent); 
            strAuditTrailLogText += '[Asset Id:' + objAsset.Id +']';
        }
        if (objPatentList !=  null  && objPatentList.size()>0)
        {
            if (Schema.sObjectType.Patent__c.isCreateable() && Patent__c.sObjectType.getDescribe().isCreateable())
            {
                insert objPatentList;  
                strAuditTrailLogText += '[Successfully Inserted]';
            }
        } 
    } 
    catch(Exception ex) 
    {
        AuditTrailStatus  = 'Fail';
        strAuditTrailLogText += '[ Insert Failed. Error:' + ex.getMessage() + ' | ' +  ex.getStackTraceString() + ' ]';
        System.debug(ex.getMessage());
    }
    finally
    {
        strAuditTrailLogText += '[ Stopped ]';
        strBatchResult += '[tr-c]';
        AuditTrail__c objAuditTrail = null;
        if (Schema.sObjectType.AuditTrail__c.isAccessible() && AuditTrail__c.sObjectType.getDescribe().isAccessible() &&  AuditTrail__c.sObjectType.getDescribe().isCreateable() && Schema.sObjectType.AuditTrail__c.isCreateable())
        {
            objAuditTrail = new AuditTrail__c();
            if(Schema.sObjectType.AuditTrail__c.fields.Action__c.isCreateable())
                objAuditTrail.Action__c = 'Insert';
            if(Schema.sObjectType.AuditTrail__c.fields.CObjectName__c.isCreateable())
                objAuditTrail.CObjectName__c = 'Migration_Asset2PatentBatch';
            if(Schema.sObjectType.AuditTrail__c.fields.Description__c.isCreateable())
                objAuditTrail.Description__c = strAuditTrailLogText;
            if(Schema.sObjectType.AuditTrail__c.fields.Status__c.isCreateable())
                objAuditTrail.Status__c = AuditTrailStatus;
            insert objAuditTrail;
            system.debug(strAuditTrailLogText);
        }
    }
}
global void finish(Database.BatchableContext BC)
{
}}

Test class: @isTest public class Migration_Asset2PatentBatchtest{

static testmethod void Migration_Asset2Patent(){

 Profile p = [SELECT Id FROM Profile WHERE Name='Outside Counsel'];
 User u1 = new User(Alias = 'standt1',Country='United Kingdom',Email='demo1@1234.com',EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',LocaleSidKey='en_US',ProfileId = p.Id,TimeZoneSidKey='America/Los_Angeles', UserName='dprobertdemo1@camfed.org');
 insert u1;

 OtherUser__c ou = New OtherUser__c();
 ou.Name ='Other User';
 ou.User__c=u1.id;
 ou.UserType__c='Paralegal';
 insert ou;

Invention_Disclosure__c objID=new Invention_Disclosure__c(Title__c='testTitle',Business_Unit__c='US',Company__c='Google',Department__c='Research',Outside_Counsel__c=u1.id);
insert objID;

Asset__c objasset0 = new Asset__c();
objasset0.Application_Number__c='52kljuh';  
insert objasset0;
system.assertequals(objasset0.Application_Number__c,'52kljuh');

Patent__c objPatent = new Patent__c();
objPatent.OldAssetId__c=objasset0.id;
objpatent.Title_of_Invention__c='new invention';
insert objPatent;
system.assertequals(objPatent.OldAssetId__c,objasset0.id);

Inventor__c objinv = new Inventor__c();
objinv.Assetrelated__c=objasset0.id;
objinv.Assetrelated_v1__c=objPatent.id;
insert objinv;

PKICertificateInfo__c pkiinfo = new PKICertificateInfo__c();
pkiinfo.CertificateName__c='certificate';
insert pkiinfo;

Portfolio__c objpotfol = new Portfolio__c();
insert objpotfol;

PKICertificateCustomer__c objpkicc = new PKICertificateCustomer__c();
objpkicc.IsWatched__c=True;
objpkicc.PKICertificate__c=pkiinfo.id;
insert objpkicc;

Country__c c = new Country__c ();
c.Name='usa';
c.Country_Code__c='ind';
c.Country_Id__c=0;
c.KeyWords__c='keyword';
insert c;
system.assertequals(c.Name,'usa');

Patent_Type__c objpattyp = new Patent_Type__c();
objpattyp.Country__c=c.id;
objpattyp.Country_Id__c=0;
objpattyp.Patent_Type_Id__c=520;
insert objpattyp;

Product__c objprod = new Product__c();
objprod.RelatedDomainNames__c='computerscience';
objprod.RelatedPatents__c='two';
insert objprod;

Entity_Type__c objentity = new Entity_Type__c();
objentity.Country__c=c.id;
objentity.Country_Id__c=0;
objentity.Entity_Type_Id__c=564;
insert objentity;
system.assertequals(objentity.Entity_Type_Id__c,564);

Patent_Status__c objpatstus = new Patent_Status__c();
objpatstus.Country__c=c.id;
objpatstus.Country_Id__c=0;
objpatstus.Patent_Status_Id__c=5355;
insert objpatstus;

Family__c objfam = new Family__c();
insert objfam;

FilingAgent__c objfilingagent = new FilingAgent__c();
objfilingagent.Country__c =c.id;
objfilingagent.Address__c='bangalore';
objfilingagent.Email__c ='maxvalgroup@gmail.com';
insert objfilingagent;

ForeignFiling_Trans__c objforeign = new ForeignFiling_Trans__c();
objforeign.Country__c=c.id;
objforeign.ParentAsset__c=objasset0.id;
objforeign.FilingAgent__c=objfilingagent.id;
insert objforeign;

Asset__c objasst= new Asset__c();
objasst.Abstract__c='a new asset created';
objasst.AIA_First_Inventor_to_File__c=true;
objasst.Application_Number__c='HNJ584';
objasst.Application_Type__c='Utility';
objasst.Approval_Status__c='Assign to OC';
objasst.Asset_Image__c='a new asset has been created';
objasst.Asset_Image_Count__c=65456;
objasst.Asset_Mapped__c=true;
objasst.AssetReferenceNewId__c='xyz58';
objasst.Asset_Status__c='Expired';
objasst.Paralegal__c=ou.id;
objasst.First_Named_Applicant__c='xyzabc';
objasst.Attorney__c='abcxyz';
objasst.Base_Invention_Disclosure__c=objID.id;
objasst.Category__c='Hardware';
objasst.Claim_Count__c=4521;
objasst.Class_Subclass__c='mnbvc';
objasst.Confirmation_Number__c=541;
objasst.ContinuityType__c='Continuation';
objasst.Correspondence_Address_Customer_Number__c='correspondence number';
objasst.Country__c=c.id;
objasst.Country_Code__c='usa5';
objasst.Diff_Filing_Date_And_First_OA__c=845;
objasst.Diff_Filing_Date_And_Issue_Date__c=5;
objasst.Diff_First_OA_And_Closing_Date__c=12;
objasst.Docket_No__c='AHN5';
objasst.Earliest_Priority_Date__c=system.today();
objasst.Entity_Status__c='Small';
objasst.Entity_Type__c=objentity.id;
objasst.EP_PTO_Link__c='https://google.com';
objasst.Error__c='new error';
objasst.ExaminationStatus__c=objpatstus.id;
objasst.Examiner_Name__c='tytr';
objasst.Expiration_Date__c=system.today();
objasst.Export_Control__c='Yes';
objasst.Family__c=objfam.id;
objasst.Family_ID__c='new family';
objasst.Application_Date__c=system.today();
objasst.Filing_or_371_c_Date__c=system.today();
objasst.ForeignFilingTrans__c=objforeign.id;
objasst.Government_contract__c='Yes';
objasst.Group_Art_Unit__c=46;
objasst.International_Reg_Number_Hague__c='international number';
objasst.International_Reg_Publication_Date__c=system.today();
objasst.Invention_Disclosure__c=objID.id;
objasst.Inventors__c='zxcs';
objasst.IPC__c='ipc';
objasst.Is_Questel__c=False;
objasst.Issue_Date_of_Patent__c=system.today();
objasst.Law_Firm_Agent__c='lowfirm agent';
objasst.LinkToPTO__c='link to pto';
objasst.Location__c='bangalore';
objasst.Location_Date__c=system.today();
objasst.nContract_Associated__c=965;
objasst.nID_Associated__c=542;
objasst.nPatent_Associated__c=812;
objasst.nProduct_Associated__c=51;
objasst.nTrademark_Associated__c=88;
objasst.Notes__c='notes';
objasst.OC_BillingNumbers__c='billing';
objasst.Attorney_Docket_Number__c='docketnumber';
objasst.Patent_Number__c='patentnumber';
objasst.Patent_Group__c='Application';
objasst.PatentNo_NoKindCode__c='nokindcode';
objasst.Patent_Status__c=objpatstus.id;
objasst.Patent_Type__c=objpattyp.id;
objasst.PKICertificateCustomer__c=objpkicc.id;
objasst.Portfolio__c =objpotfol.id;
objasst.Previous_Owner__c='previouswner';
objasst.Primary_Inventor__c=objinv.id;
objasst.Priority_Date__c=system.today();
objasst.Priority_Dates__c='prioritydates';
objasst.Priority_Number__c='number';
objasst.Product__c=objprod.id;
objasst.Status__c='Invention Disclosed';
objasst.Status_Date__c=system.today();
objasst.PTO_Link__c='https://google.com';
objasst.Earliest_Publication_Date__c=system.today();
objasst.Earliest_Publication_No__c='publication';
objasst.Earliest_Publication_No_NoKindCode__c='mnb';
objasst.Region__c='Europe';
objasst.Remarks__c='enter remark';
objasst.Description__c='descrip';
objasst.Term_Date__c=system.today();
objasst.Title_of_Invention__c='new invention';
objasst.US_PTO_Link__c='htttp://google.com';
insert objasst;

test.starttest(); Migration_Asset2PatentBatch migast2patbatch = new Migration_Asset2PatentBatch(); //how to call global methdod

test.stoptest();

} }

closed as off-topic by Markus Slabina, Gortonington, glls, battery.cord, Brian Mansfield Aug 31 '17 at 14:04

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – Markus Slabina, glls, battery.cord, Brian Mansfield
If this question can be reworded to fit the rules in the help center, please edit the question.

2

Once you've setup all data for testing simply use Database.executBatch() apex method in your test class. Refer below sample code:

Test.startTest();
Migration_Asset2PatentBatch migAssetPatent= new Migration_Asset2PatentBatch ();
Id batchId = Database.executeBatch(migAssetPatent);
Test.stopTest();

Refer this salesforce trailhead for Batch Apex

Not the answer you're looking for? Browse other questions tagged or ask your own question.