lrj
5 天以前 4fa9591629721797386fc11836e3a9deb69cd58c
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
package com.rongyichuang.judge;
 
import com.rongyichuang.judge.dto.response.JudgeResponse;
import com.rongyichuang.judge.service.JudgeService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.List;
 
@SpringBootTest
@ActiveProfiles("test")
@Transactional
public class JudgeAvatarTest {
 
    @Autowired
    private JudgeService judgeService;
 
    @Test
    public void testJudgeAvatarUrls() {
        System.out.println("=== 测试评委头像URL构建 ===");
        
        List<JudgeResponse> judges = judgeService.findAll();
        System.out.println("找到 " + judges.size() + " 个评委");
        
        for (JudgeResponse judge : judges) {
            System.out.println("评委ID: " + judge.getId() + 
                             ", 姓名: " + judge.getName() + 
                             ", 头像URL: " + judge.getAvatarUrl());
        }
        
        // 测试前5个评委的头像URL
        judges.stream()
              .limit(5)
              .forEach(judge -> {
                  String avatarUrl = judge.getAvatarUrl();
                  if (avatarUrl != null) {
                      System.out.println("评委 " + judge.getName() + " 的头像URL: " + avatarUrl);
                      // 验证URL是否为完整URL
                      if (avatarUrl.startsWith("https://")) {
                          System.out.println("✓ 头像URL格式正确");
                      } else {
                          System.out.println("✗ 头像URL格式可能有问题: " + avatarUrl);
                      }
                  } else {
                      System.out.println("评委 " + judge.getName() + " 没有头像");
                  }
              });
    }
}