@Test public void fetchPathways() { ImmutableSet<String> pathwayIds = ImmutableSet.of("R-FOO-111", "R-FOO-222", "R-FOO-333"); when(restTemplateMock.postForObject( eq(ReactomeClient.URL), eq(pathwayIds.stream().collect(Collectors.joining(","))), eq(String.class))) .thenReturn("[" + "{\"stId\":\"R-FOO-111\", \"displayName\":\"Bar signal\"}, " + "{\"stId\":\"R-FOO-222\", \"displayName\":\"Bar receptor\"}, " + "{\"stId\":\"R-FOO-333\", \"displayName\":\"Bar regulator\"}]"); Map<String, String> result = subject.getPathwayNames(pathwayIds); assertThat(result.keySet(), hasSize(3)); assertThat(result, hasEntry(is("R-FOO-111"), is("Bar signal"))); assertThat(result, hasEntry(is("R-FOO-222"), is("Bar receptor"))); assertThat(result, hasEntry(is("R-FOO-333"), is("Bar regulator"))); }
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);  }