GeneScore implements Comparable<GeneScore> { public int compareTo(GeneScore anotherGeneScore) { return GeneScore.compare(this, anotherGeneScore); } private  GeneScore(Builder builder); GeneIdentifier getGeneIdentifier(); ModeOfInheritance getModeOfInheritance(); float getCombinedScore(); float getPhenotypeScore(); float getVariantScore(); List<VariantEvaluation> getContributingVariants(); boolean hasContributingVariants(); static GeneScore max(GeneScore s1, GeneScore s2); int compareTo(GeneScore anotherGeneScore); static int compare(GeneScore s1, GeneScore s2); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static GeneScore empty(); static Builder builder();  }
@Test public void testCompareTo() { GeneIdentifier first = GeneIdentifier.builder().geneSymbol("1ABC").build(); GeneIdentifier second = GeneIdentifier.builder().geneSymbol("1BBC").build(); GeneIdentifier third = GeneIdentifier.builder().geneSymbol("2BCD").build(); GeneScore one = GeneScore.builder().combinedScore(1f).geneIdentifier(first).build(); GeneScore two = GeneScore.builder().combinedScore(0.5f).geneIdentifier(first).build(); GeneScore three = GeneScore.builder().combinedScore(0.5f).geneIdentifier(second).build(); GeneScore four = GeneScore.builder().combinedScore(0.25f).geneIdentifier(second).build(); GeneScore five = GeneScore.builder().combinedScore(0.25f).geneIdentifier(third).build(); GeneScore six = GeneScore.builder().combinedScore(0.125f).geneIdentifier(third).build(); List<GeneScore> geneScores = Arrays.asList(two, three, six, one, five, four); geneScores.sort(GeneScore::compareTo); assertThat(geneScores, equalTo(Arrays.asList(one, two, three, four, five, six))); }