张世豪
昨天 00f4e4fc6e53a26cf3dc67d57d8b00536634d707
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package login;
 
/**
 * 登录功能测试运行类
 * 可以直接运行此类的main方法来测试登录功能
 */
public class LoginTestRunner {
    
    public static void main(String[] args) {
        System.out.println("========== 登录功能测试开始 ==========\n");
        
        // 测试邮箱验证码发送
        //testSendEmailCode();
        
        // 测试登录验证
        testVerifyLogin();
        
        // 测试用户注册
        //testUserRegister();
 
        
    }
    
    /**
     * 测试发送邮箱验证码
     */
    private static void testSendEmailCode() {
        System.out.println("【测试1】发送邮箱验证码");
        System.out.println("----------------------------------------");
        
        // 测试正常邮箱
        String testEmail = "979909237@qq.com";
        System.out.println("测试邮箱: " + testEmail);
        
        EmailCodeSender.EmailCodeResponse response = EmailCodeSender.sendEmailCode(testEmail);
        
        System.out.println("请求结果:");
        System.out.println("  ✓ 成功: " + response.isSuccess());
        System.out.println("  ✓ 状态码: " + response.getStatusCode());
        System.out.println("  ✓ 消息: " + response.getMessage());
        if (response.getResponseBody() != null && !response.getResponseBody().isEmpty()) {
            System.out.println("  ✓ 响应体: " + response.getResponseBody());
        }
        System.out.println();
    }
    
    /**
     * 测试登录验证
     */
    private static void testVerifyLogin() {
        System.out.println("【测试2】登录验证");
        System.out.println("----------------------------------------");
        
        String email = "979909237@qq.com";
        String password = "password123";
        
        System.out.println("测试参数:");
        System.out.println("  - 邮箱: " + email);
        System.out.println("  - 密码: " + password);
        
        LoginVerifier.LoginVerifyResponse response = LoginVerifier.verifyLogin(email, password);
        
        System.out.println("验证结果:");
        System.out.println("  ✓ 成功: " + response.isSuccess());
        System.out.println("  ✓ 状态码: " + response.getStatusCode());
        System.out.println("  ✓ 消息: " + response.getMessage());
        if (response.getResponseBody() != null && !response.getResponseBody().isEmpty()) {
            System.out.println("  ✓ 响应体: " + response.getResponseBody());
        }
        System.out.println();
    }
    
    /**
     * 测试用户注册
     */
    private static void testUserRegister() {
        System.out.println("【测试3】用户注册");
        System.out.println("----------------------------------------");
        
        String email = "979909237@qq.com";
        String password = "password123";
        String code = "709212";
        String nickname = "zshTest";
        
        System.out.println("测试参数:");
        System.out.println("  - 邮箱: " + email);
        System.out.println("  - 密码: " + password);
        System.out.println("  - 验证码: " + code);
        System.out.println("  - 昵称: " + nickname);
        
        UserRegister.RegisterResponse response = UserRegister.register(email, password, code, nickname,password);
        
        System.out.println("注册结果:");
        System.out.println("  ✓ 成功: " + response.isSuccess());
        System.out.println("  ✓ 状态码: " + response.getStatusCode());
        System.out.println("  ✓ 消息: " + response.getMessage());
        if (response.getResponseBody() != null && !response.getResponseBody().isEmpty()) {
            System.out.println("  ✓ 响应体: " + response.getResponseBody());
        }
        System.out.println();
    }
    
 
 
}