rename controller

This commit is contained in:
Carsten Otto
2021-11-12 09:06:55 +01:00
parent 2f8980db0f
commit 3888614d56
3 changed files with 8 additions and 8 deletions

View File

@@ -20,8 +20,8 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
@WebMvcTest(controllers = NodeController.class)
class NodeControllerIT {
@WebMvcTest(controllers = LegacyController.class)
class LegacyControllerIT {
@Autowired
private MockMvc mockMvc;

View File

@@ -13,10 +13,10 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/api/node/{pubkey}/")
public class NodeController {
public class LegacyController {
private final NodeService nodeService;
public NodeController(NodeService nodeService) {
public LegacyController(NodeService nodeService) {
this.nodeService = nodeService;
}

View File

@@ -17,9 +17,9 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
@ExtendWith({MockitoExtension.class})
class NodeControllerTest {
class LegacyControllerTest {
@InjectMocks
private NodeController nodeController;
private LegacyController legacyController;
@Mock
private NodeService nodeService;
@@ -27,14 +27,14 @@ class NodeControllerTest {
@Test
void getAlias() {
when(nodeService.getAlias(PUBKEY)).thenReturn(ALIAS);
assertThat(nodeController.getAlias(PUBKEY)).isEqualTo(ALIAS);
assertThat(legacyController.getAlias(PUBKEY)).isEqualTo(ALIAS);
}
@Test
void getOpenChannelIds() {
// jq is confused by large numbers, return string instead
when(nodeService.getOpenChannelIds(PUBKEY)).thenReturn(List.of(CHANNEL_ID, CHANNEL_ID_3));
assertThat(nodeController.getOpenChannelIds(PUBKEY)).containsExactly(
assertThat(legacyController.getOpenChannelIds(PUBKEY)).containsExactly(
CHANNEL_ID.toString(),
CHANNEL_ID_3.toString()
);