建设网站需要学什么网站广告条效果

个人简介:Java领域新星创作者;阿里云技术博主、星级博主、专家博主;正在Java学习的路上摸爬滚打,记录学习的过程~
个人主页:.29.的博客
学习社区:进去逛一逛~

设置随机数据——常用于测试用例
- SpringBoot设置随机数据
 - 可设置的随机数据 详解:
 
SpringBoot设置随机数据
- 测试用例常常采用随机值进行测试,可以在SpringBoot配置文件中设置随机数据
 
yml配置文件:
testcase:book:id: ${random.int}type: ${random.value}name: ${random.uuid}description: ${random.long}
 
实体类中注入配置文件设置的随机数据:
/*** @author .29.* @create 2023-04-02 10:45*/
@Component
@Data
@ConfigurationProperties(prefix = "testcase.book")
public class BookCase {private int id;private String type;private String name;private String description;
} 
测试用例:
/*** @author .29.* @create 2023-04-02 10:50*/
@SpringBootTest
public class testRandom {@Autowiredprivate BookCase bookCase;@Testvoid random(){System.out.println(bookCase);}
}
 
可设置的随机数据 详解:
${random.int}—— 随机整数${random.int(10)}—— 10以内的随机整数${random.int(10,20)}—— 10~20的随机整数${random.uuid}—— 随机uuid${random.value}—— 随机字符串,MD5字符串,32位${random.long}—— 随机整数(long范围内)
testcase:book: id: ${random.int}            # 随机整数id2: ${random.int(10)}       # 10以内的随机整数type: ${random.int(10,20)}  # 10~20的随机整数uuid: ${random.uuid}         # 随机uuidname: ${random.value}        # 随机字符串,MD5字符串,32位long: ${random.long}         # 随机整数(long范围内)
 


