@isTest
public with sharing class NFM503InfoFileBatchTest {
	@testSetup
	static void makeTestQLM503() {
		// ADD BY SUSHANHU FOR PI START
		TestDataUtility.CreatePIPolicyConfiguration('NFM503');
		// ADD BY SUSHANHU FOR PI END
		BatchIF_Transfer__c transfer1 = new BatchIF_Transfer__c();
		transfer1.Table__c          = 'QLMoldMark';
		transfer1.Internal_Value__c = '*';
		insert transfer1;

		List<BatchIF_Transfer__c> NFM501GainEndTimeTransfers = new List<BatchIF_Transfer__c>();
		BatchIF_Transfer__c transfer2 = new BatchIF_Transfer__c();
		transfer2.Table__c          = 'NFM501GainEndTime';
		transfer2.NFM501_Gain_End_Time__c = Datetime.now();
		NFM501GainEndTimeTransfers.add(transfer2);
		insert NFM501GainEndTimeTransfers;

		List<BatchIF_Transfer__c> NFM501TokenTransfers = new List<BatchIF_Transfer__c>();
		BatchIF_Transfer__c transfer3 = new BatchIF_Transfer__c();
		transfer3.Table__c          = 'NFM501Token';
		transfer3.NFM501_Token__c = 'eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiIwNzBmMDBiZi02NGYxLTQ3MjAtYThkOC1iYmUxYWE5NzZkMjIiLCJhcHBTZWNyZXQiOiI2N0JCMkJBRkM4QUEwQkEwQ0FCQjM3Q0JGNTBFQzI5MiIsImV4cCI6MTYyNDI2MTc1OX0.s55zh9SSpwqRdp1wXH43_wEGpwlZtMfRgl1x8t69A-N0H7QrzRNmK5MNqNGGLhQ2LL_AbMSJmDfwO5chgwndoA';
		NFM501TokenTransfers.add(transfer3);
		insert NFM501TokenTransfers;

		Tender_information__c Ten = new Tender_information__c();
		Ten.Name = '123456';
		Ten.InfoTitle__c = '123456';
		Ten.ProjectId__c = '38_99df2844cf784982acdc61d00d7a7dbb';
		insert Ten;

		bidInfoFile__c bidInfoFile  = new bidInfoFile__c();
		bidInfoFile.Tender_information__c = Ten.Id;
		bidInfoFile.infoAddress__c = 'http://aa.aa.com';
		insert bidInfoFile;
	}

	@IsTest
	static void Test503() {
		List<bidInfoFile__c> bidInfoFileList = [Select Id, infoAddress__c, ErrorMessage__c,
		                                        Tender_information__c, Tender_information__r.Id, 
		                                        isProcessed__c from bidInfoFile__c];
		Test.setMock(HttpCalloutMock.class, new NFM501HttpCallMock());
		Test.StartTest();
		Database.executeBatch( new NFM503InfoFileBatch(bidInfoFileList[0].id, false), 1);
		NFM503InfoFileSchedule.assignOneMinute();
		NFM503InfoFileSchedule.test();
		Test.stopTest();

	}
	@IsTest
	static void myTest1() {
		List<bidInfoFile__c> bidInfoFileList = [Select Id, infoAddress__c, ErrorMessage__c,
		                                        Tender_information__c, Tender_information__r.Id, 
		                                        isProcessed__c from bidInfoFile__c];
		Test.setMock(HttpCalloutMock.class, new NFM501HttpCallMockEx());
		Test.StartTest();
		Database.executeBatch( new NFM503InfoFileBatch(bidInfoFileList[0].id), 1);
		Test.stopTest();
	}
	// @IsTest
	// static void myTest2() {
	// 	List<bidInfoFile__c> bidInfoFileList = [Select Id, infoAddress__c, ErrorMessage__c,
	// 	                                        Tender_information__c, Tender_information__r.Id, 
	// 	                                        isProcessed__c from bidInfoFile__c];
	// 	Test.setMock(HttpCalloutMock.class, new NFM501HttpCallMockEx());
	// 	Test.StartTest();
	// 	Database.executeBatch( new NFM503InfoFileBatch(bidInfoFileList[0].id, false, false), 1);
	// 	Test.stopTest();
	// }

}