I have a Mock in Test that has JSON and it's big. How to load it from a file. Whether Mock should be in the resource directory or should it be in the test directory.
@ExtendWith(MockitoExtension.class) class HubServiceTest { @InjectMocks private HubService hubService; @Mock private ConnectHttp connectHttp; private Controller controller; @Test public void shouldReturnCorrectRepositories() { when(connectHttp.connect(Mockito.any())).thenReturn("[\n" + " {\n" + " \"id\": 277322841,\n" + " \"node_id\": \"MDEwOlJlcG9zaXRvcnkyNzczMjI4NDE=\",\n"}]") <pre> List<PojoGitHub> result = hubService.getRepositories("test"); assertThat(result).isNotNull(); }
I set it stiff in a mock
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)