@Test public void testViewExternalIdentifiersHtml() { when(mockServiceDelegator.findExternalIdentifiersFromPublicCache(any(String.class))) .thenReturn(successResponse); Response response = t1OrcidApiService.viewExternalIdentifiersHtml("orcid"); assertEquals(200, response.getStatus()); }
@Before public void subvertDelegator() { mockServiceDelegator = mock(OrcidApiServiceDelegator.class); // view status is always fine when(mockServiceDelegator.viewStatusText()).thenReturn(successResponse); t1OrcidApiService.setOrcidApiServiceDelegator(mockServiceDelegator); }
@Test public void testViewBioDetailsJson() { when(mockServiceDelegator.findBioDetailsFromPublicCache(any(String.class))) .thenReturn(successResponse); Response response = t1OrcidApiService.viewBioDetailsJson("orcid"); assertEquals(200, response.getStatus()); }
@Test public void testSearchByQueryXML() { UriInfo uriInfo = mock(UriInfo.class); t1OrcidApiService.setUriInfo(uriInfo); MultivaluedMap<String, String> queryMaps = queryParams(); when(uriInfo.getQueryParameters()).thenReturn(queryMaps); when(mockServiceDelegator.publicSearchByQuery(queryMaps)).thenReturn(successResponse); Response response = t1OrcidApiService.searchByQueryXML("orcid"); assertEquals(200, response.getStatus()); }