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() + " 没有头像");
|
}
|
});
|
}
|
}
|