@ExtendWith(MockitoExtension.class) class ServiceTest {
@InjectMocks
private Service Service;
@Mock
private ConnectHttp connectHttp;
private Controller controller;
@Test
public void shouldReturnCorrectRepositories() {
when(connectHttp.connect(Mockito.any())).thenReturn("[{"full_name":"Mario/Aplication-Thoughts","description":null,"clone_url":"https://github.com/Mario/Aplication-Thoughts.git","owner":{"login":"Mario","starred_url":"https://api.github.com/users/Mario/starred{/owner}{/repo}"},"created_at":"2020-09-05T14:52:42Z"},
{"full_name":"Mario/Calculatev1","description":null,"clone_url":"https://github.com/Mario/Calculatev1.git","owner":{"login":"Mario","starred_url":"https://api.github.com/users/Mario/starred{/owner}{/repo}"},"created_at":"2019-01-10T23:04:18Z"}, {"full_name":"Mario/Cantor-App","description":null,"clone_url":"https://github.com/Mario/Cantor-App.git","owner":{"login":"Mario","starred_url":"https://api.github.com/users/Mario/starred{/owner}{/repo}"},"created_at":"2019-09-27T07:50:12Z"}]"); List result = gitHubService.getRepositories("test");
assertThat(result).isNotNull();
}
"
Aucun commentaire:
Enregistrer un commentaire