mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-22 23:44:21 +01:00
configure jackson in ObjectMapperConfiguration
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package de.cotto.lndmanagej.controller;
|
||||
|
||||
import de.cotto.lndmanagej.controller.dto.ObjectMapperConfiguration;
|
||||
import de.cotto.lndmanagej.model.ChannelIdResolver;
|
||||
import de.cotto.lndmanagej.service.ChannelService;
|
||||
import de.cotto.lndmanagej.service.OwnNodeService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static de.cotto.lndmanagej.model.LocalOpenChannelFixtures.LOCAL_OPEN_CHANNEL;
|
||||
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.content;
|
||||
|
||||
@WebMvcTest(controllers = StatusController.class)
|
||||
@Import(ObjectMapperConfiguration.class)
|
||||
class ObjectMapperConfigurationIT {
|
||||
private static final String PREFIX = "/api/status/";
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@MockBean
|
||||
@SuppressWarnings("unused")
|
||||
private ChannelIdResolver channelIdResolver;
|
||||
|
||||
@MockBean
|
||||
private ChannelService channelService;
|
||||
|
||||
@MockBean
|
||||
@SuppressWarnings("unused")
|
||||
private OwnNodeService ownNodeService;
|
||||
|
||||
@Test
|
||||
void output_is_pretty_printed() throws Exception {
|
||||
when(channelService.getOpenChannels()).thenReturn(Set.of(LOCAL_OPEN_CHANNEL));
|
||||
mockMvc.perform(get(PREFIX + "/open-channels/"))
|
||||
.andExpect(content().string("{\n \"channels\" : [ \"712345x123x1\" ]\n}"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user