@isTest
|
private class Sfdc2PoUserBatchTest {
|
public static User user = new User();
|
private static void init() {
|
Profile p = [select Id from Profile where id =: System.Label.ProfileId_SystemAdmin];
|
//User user = new User();
|
user.LastName = 'LastName';
|
user.FirstName = 'FirstName';
|
user.Alias = 'Alias';
|
user.Email = 'olympustest03@sunbridge.com';
|
user.Username = 'olympustest03@sunbridge.com';
|
user.CommunityNickname = 'CommunityNickname';
|
user.IsActive = true;
|
user.EmailEncodingKey = 'ISO-2022-JP';
|
user.TimeZoneSidKey = 'Asia/Tokyo';
|
user.LocaleSidKey = 'ja_JP';
|
user.LanguageLocaleKey = 'ja';
|
user.ProfileId = p.Id;
|
user.Job_Category__c = '销售推广';
|
user.Province__c = '上海市';
|
user.Post__c = '经理';
|
user.MobilePhone = '54321';
|
user.Mobile_Phone__c = '12345';
|
//user.Employee_No__c = '0011';
|
user.Work_Location__c = 'Location';
|
user.Use_Start_Date__c = Date.today().addMonths(-6);
|
user.IsMEBG__c = true;
|
user.Stay_or_not__c = '在职';
|
user.SendToComPlat__c = false;
|
insert user;
|
|
}
|
static testMethod void testMethod1() {
|
init();
|
|
System.runAs(user) {
|
System.Test.startTest();
|
List < String > userID = new List < String >();
|
userID.add(user.Id);
|
Database.executeBatch(new Sfdc2PoUserBatch(userID), 1);
|
System.Test.stopTest();
|
}
|
}
|
static testMethod void testMethod2() {
|
init();
|
System.runAs(user) {
|
System.Test.startTest();
|
|
If(Test.isRunningTest()){
|
ID jobID = Database.executeBatch(new Sfdc2PoUserBatch(), 100);
|
System.abortJob(jobID);
|
}
|
System.Test.stopTest();
|
}
|
}
|
}
|