EuropePmcClient { public Optional<Publication> getPublicationByIdentifier(String identifier) { return parseResponseWithOneResult(identifier); } @Inject  EuropePmcClient(RestTemplate restTemplate); Optional<Publication> getPublicationByIdentifier(String identifier);  }
@Test public void returnsNoResultsIfEuropePmcIsUnavailable() { when(restTemplateMock.getForEntity(MessageFormat.format(URL, anyString()), eq(String.class))) .thenThrow(RestClientException.class); assertThat(subject.getPublicationByIdentifier("foo")).isEmpty(); }