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(); } }