@MockBean
private RestTemplateBuilder restTemplateBuilder;
@MockBean
private RestTemplate restTemplate;
@InjectMocks
private FetchCoreVersionsList fetchCoreVersionsList;
@Test
public void testCoreVersionsJsonHandle() throws Exception{
when(restTemplate.getForObject("https://openmrs.jfrog.io/openmrs/api/storage/public/org/openmrs/api/openmrs-api/",
String.class))
.thenReturn(new ObjectMapper().readValue(getFileAsString("core-versions.json"), String.class));
}
On running the test , I get the following error
org.mockito.exceptions.misusing.UnfinishedStubbingException:
Unfinished stubbing detected here: -> at org.openmrs.addonindex.scheduled.FetchCoreVersionsListIT.testCoreVersionsJsonHandle(FetchCoreVersionsListIT.java:66)
I am pretty new to creating test cases so kindly bear with me if its something silly :)