小编Fre*_*die的帖子

找不到符号符号方法 of() 位置接口 java.util.list、unittests

我目前正在开发一个 Spring Boot 应用程序,我正在其中编写单元测试。但是当我运行命令“mvn test”时,出现以下错误:

在此输入图像描述

这是代码

BoardServiceTest.java

@Test
public void testGetBoards() {
    Set<Lists> list =  new HashSet<Lists>();
    
    List<Board> expectedBoards = List.of(
        new Board(1, "Studie", list),
        new Board(2, "Todo Applicatie", list)
    );
    
    when(this.boardRepo.findAll()).thenReturn(expectedBoards);
    
    var receivedBoards = this.boardService.getBoards();
    assertEquals(expectedBoards, receivedBoards);
    verify(this.boardRepo, times(1)).findAll();
}
Run Code Online (Sandbox Code Playgroud)

列表服务测试.java

@Test
public void testGetLists() throws Exception {   
    int boardId = 1;
    Set<Task> task = new HashSet<>();

    List<Lists> expectedLists = List.of(
        new Lists(1, "registered", new Board(), task),
        new Lists(2, "open", new Board(), task)
    );
    
    when(this.listRepository.findAll()).thenReturn(expectedLists);
    
    var receivedLists = this.listService.getLists(boardId); …
Run Code Online (Sandbox Code Playgroud)

java list spring-boot

0
推荐指数
1
解决办法
1万
查看次数

标签 统计

java ×1

list ×1

spring-boot ×1