H2ScoreDistributionWriter implements ScoreDistributionWriter { @Override public void write(int numTerms, ScoreDistribution scoreDistribution, int resolution) throws PhenolException { for (TermId objectId : scoreDistribution.getObjectIds()) { final ObjectScoreDistribution dist = scoreDistribution.getObjectScoreDistribution(objectId); writeObjectScoreDistribution(numTerms, dist, resolution); } } H2ScoreDistributionWriter(String pathDb, String dataTableName, boolean resetTableIfExists); @Override void close(); @Override void write(int numTerms, ScoreDistribution scoreDistribution, int resolution);  }
@Test void write_int_key_scoredistribution() throws Exception{ Map<TermId, ObjectScoreDistribution> scoreDistributionMap = new HashMap<>(); TermId tid1 = TermId.of("HP:1"); SortedMap<Double, Double> sortedMap = ImmutableSortedMap.of(0.0, 0.2, 0.5, 0.6, 1.0, 1.0); scoreDistributionMap.put(tid1, new ObjectScoreDistribution(tid1, 2, 3, sortedMap)); ScoreDistribution integerScoreDistribution = new ScoreDistribution(2, scoreDistributionMap); Assertions.assertDoesNotThrow(() -> dbWriter.write(2, integerScoreDistribution)); }
@Test void write_obj_key_scoredistribution() throws Exception{ TermId termId = TermId.of("MONDO", "001"); Map<TermId, ObjectScoreDistribution> scoreDistributionMap = new HashMap<>(); SortedMap<Double, Double> sortedMap = ImmutableSortedMap.of(0.0, 0.2, 0.5, 0.6, 1.0, 1.0); scoreDistributionMap.put(termId, new ObjectScoreDistribution(termId, 2, 3, sortedMap)); ScoreDistribution objScoreDistribution = new ScoreDistribution(2, scoreDistributionMap); Assertions.assertDoesNotThrow(() -> dbWriter.write(2, objScoreDistribution)); }