@isTest
private class lexSubAuthorizedButtonControllerTest {
    public static Account account1 = new Account();
    public static Account account2 = new Account();
    public static Contact contact1 = new Contact();
    public static Contact contact2 = new Contact();
    static testMethod void testMethod1() {
        lexSubAuthorizedButtonController.init('123');
        List<user> userList = new List<user>();
        Profile p = [select Id from Profile where Name = '系统管理员'];
        UserRole ur = [ SELECT Id, Name FROM UserRole where Name = 'OCSM SFDC管理员'];
        UserRole urtop = [ SELECT Id, Name FROM UserRole where Name = '总经理'];
        string userinfoId = UserInfo.getUserId();
        User tempUser = [select id from user where id = : userinfoId];
        User user1 = new User(Test_staff__c = true, LastName = 'hp',
                              FirstName = 'owner', Alias = 'hp',
                              CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com',
                              Username = 'olympus_hpowner@sunbridge.com', IsActive = true,
                              EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo',
                              LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja');
        user1.ProfileId = p.Id;
        user1.UserRoleId  = ur.id;
        User user2;
        User user3;
        system.runAs(tempUser) {
            userList.add(user1);
            user2 = new User(Test_staff__c = true, LastName = 'hp',
                             FirstName = 'owner', Alias = 'hp',
                             CommunityNickname = 'hpOwner1', Email = '2olympus_hpowner@sunbridge.com',
                             Username = '2olympus_hpowner@sunbridge.com', IsActive = true,
                             EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo',
                             LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja');
            user2.ProfileId = p.Id;
            user2.UserRoleId  = urtop.id;
        }
        system.runAs(user1) {
            SubAuthorized__c tempSubAuthor = new SubAuthorized__c();
            tempSubAuthor.Status__c  = '已批准';
            tempSubAuthor.AuthorizedStartDate__c = Date.today().adddays(1);
            tempSubAuthor.AuthorizedEndDate__c = Date.today().adddays(2);
            tempSubAuthor.Authorizee__c = user2.id;
            tempSubAuthor.Authorizer__c = user1.id;
            insert tempSubAuthor;
            lexSubAuthorizedButtonController.init(tempSubAuthor.Id);
            lexSubAuthorizedButtonController.updateStatuById(tempSubAuthor.Id);
            lexSubAuthorizedButtonController.updateStatuById('xxx123xxx');
        }
        system.debug('test!!');
       
    }
}