diff --git a/web/src/integrationTest/java/de/cotto/lndmanagej/ui/DashboardControllerTest.java b/web/src/integrationTest/java/de/cotto/lndmanagej/ui/DashboardControllerTest.java index edccef73..6a9e1102 100644 --- a/web/src/integrationTest/java/de/cotto/lndmanagej/ui/DashboardControllerTest.java +++ b/web/src/integrationTest/java/de/cotto/lndmanagej/ui/DashboardControllerTest.java @@ -1,11 +1,10 @@ package de.cotto.lndmanagej.ui; -import de.cotto.lndmanagej.controller.ChannelIdConverter; +import de.cotto.lndmanagej.model.ChannelIdResolver; import de.cotto.lndmanagej.ui.controller.DashboardController; import de.cotto.lndmanagej.ui.dto.NodeDto; import de.cotto.lndmanagej.ui.dto.OpenChannelDto; import de.cotto.lndmanagej.ui.dto.StatusModel; -import de.cotto.lndmanagej.ui.model.OpenChannelDtoFixture; import de.cotto.lndmanagej.ui.page.PageService; import de.cotto.lndmanagej.ui.page.general.DashboardPage; import org.junit.jupiter.api.Test; @@ -18,7 +17,9 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import java.util.List; import static de.cotto.lndmanagej.controller.dto.NodesAndChannelsWithWarningsDto.NONE; -import static org.mockito.BDDMockito.given; +import static de.cotto.lndmanagej.ui.model.OpenChannelDtoFixture.OPEN_CHANNEL_DTO; +import static org.mockito.Mockito.when; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @WebMvcTest(controllers = DashboardController.class) @@ -30,25 +31,25 @@ class DashboardControllerTest { @MockBean private PageService pageService; - @SuppressWarnings("unused") @MockBean - private ChannelIdConverter channelIdConverter; + @SuppressWarnings("unused") + private ChannelIdResolver channelIdResolver; @Test - void testEmptyDashboard() throws Exception { - given(this.pageService.dashboard()).willReturn( + void empty_dashboard() throws Exception { + when(pageService.dashboard()).thenReturn( new DashboardPage(List.of(), List.of(), new StatusModel(true, 1, NONE)) ); - mockMvc.perform(MockMvcRequestBuilders.get("/")).andExpect(status().isOk()); + mockMvc.perform(get("/")).andExpect(status().isOk()); } @Test - void testDashboard() throws Exception { - OpenChannelDto channel = OpenChannelDtoFixture.OPEN_CHANNEL_DTO; + void dashboard() throws Exception { + OpenChannelDto channel = OPEN_CHANNEL_DTO; NodeDto node = new NodeDto(channel.remotePubkey().toString(), channel.remoteAlias(), true); - given(this.pageService.dashboard()).willReturn( + when(this.pageService.dashboard()).thenReturn( new DashboardPage(List.of(channel), List.of(node), new StatusModel(true, 1, NONE)) ); - mockMvc.perform(MockMvcRequestBuilders.get("/")).andExpect(status().isOk()); + mockMvc.perform(get("/")).andExpect(status().isOk()); } }