@Test public void returnEmptyIfSomethingGoesWrong() { when(restTemplateMock.postForObject(eq(ReactomeClient.URL), anyString(), eq(String.class))) .thenThrow(new RestClientException("Timeout!")); assertThat(subject.getPathwayNames(ImmutableSet.of("R-FOO-123")).entrySet(), hasSize(0)); }
public ImmutableMap<String, String> getPathwayNames(Collection<String> stableIds) { ImmutableMap.Builder<String, String> mappedStableIdsBuilder = ImmutableMap.builder(); for (List<String> partition : getPartitions(stableIds)) { mappedStableIdsBuilder.putAll(fetchPathwayNames(partition)); } return getMappedIds(stableIds, mappedStableIdsBuilder); }
ReactomeClient { public ImmutableMap<String, String> getPathwayNames(Collection<String> stableIds) { ImmutableMap.Builder<String, String> mappedStableIdsBuilder = ImmutableMap.builder(); for (List<String> partition : getPartitions(stableIds)) { mappedStableIdsBuilder.putAll(fetchPathwayNames(partition)); } return getMappedIds(stableIds, mappedStableIdsBuilder); } }
ReactomeClient { public ImmutableMap<String, String> getPathwayNames(Collection<String> stableIds) { ImmutableMap.Builder<String, String> mappedStableIdsBuilder = ImmutableMap.builder(); for (List<String> partition : getPartitions(stableIds)) { mappedStableIdsBuilder.putAll(fetchPathwayNames(partition)); } return getMappedIds(stableIds, mappedStableIdsBuilder); } @Inject  ReactomeClient(RestTemplate restTemplate); }
ReactomeClient { public ImmutableMap<String, String> getPathwayNames(Collection<String> stableIds) { ImmutableMap.Builder<String, String> mappedStableIdsBuilder = ImmutableMap.builder(); for (List<String> partition : getPartitions(stableIds)) { mappedStableIdsBuilder.putAll(fetchPathwayNames(partition)); } return getMappedIds(stableIds, mappedStableIdsBuilder); } @Inject  ReactomeClient(RestTemplate restTemplate); Optional<String> getPathwayName(String reactomeId); Optional<String> getPlantPathwayName(String reactomeId); ImmutableMap<String, String> getPathwayNames(Collection<String> stableIds); ImmutableMap<String, String> getPlantPathwayNames(Collection<String> stableIds); }
ReactomeClient { public ImmutableMap<String, String> getPathwayNames(Collection<String> stableIds) { ImmutableMap.Builder<String, String> mappedStableIdsBuilder = ImmutableMap.builder(); for (List<String> partition : getPartitions(stableIds)) { mappedStableIdsBuilder.putAll(fetchPathwayNames(partition)); } return getMappedIds(stableIds, mappedStableIdsBuilder); } @Inject  ReactomeClient(RestTemplate restTemplate); Optional<String> getPathwayName(String reactomeId); Optional<String> getPlantPathwayName(String reactomeId); ImmutableMap<String, String> getPathwayNames(Collection<String> stableIds); ImmutableMap<String, String> getPlantPathwayNames(Collection<String> stableIds);  }