HistogramService { protected HistogramAcrossGenes get(String accession, String accessKey, O streamOptions) { try { return cache.get(HistogramCacheKey.create(accession, accessKey, streamOptions)); } catch (ExecutionException e) { throw new RuntimeException(e); } } HistogramService(final ProfileStreamFactory<?, ?, E, O, ?> profileStreamFactory,
                            final ExperimentTrader experimentTrader,
                            final double[] cutoffBins);   }
@Test public void testGet() { BaselineProfileStreamOptions<ExpressionUnit.Absolute.Rna> baselineProfileStreamOptions = new BaselineRequestContext<>(new RnaSeqBaselineRequestPreferences(), experiment); JsonObject result = subject.get("accession", "", baselineProfileStreamOptions).asJson(); assertThat(result.has("bins"), is(true)); Mockito.verify(rnaSeqBaselineProfileStreamFactory) .histogram(experiment, baselineProfileStreamOptions, cutoffScale.get()); }
@Test public void cachingWorks() { subject.get( "accession", "", new BaselineRequestContext<>(new RnaSeqBaselineRequestPreferences(), experiment)).asJson(); subject.get( "accession", "", new BaselineRequestContext<>(new RnaSeqBaselineRequestPreferences(), experiment)).asJson(); Mockito.verify(rnaSeqBaselineProfileStreamFactory, times(1)) .histogram(eq(experiment), ArgumentMatchers.any(), eq(cutoffScale.get())); }