### Question:
ComparisonResult implements Comparable<ComparisonResult> { public int compareTo(ComparisonResult o) { if (o == null) { return 1; } else { if (!o.getPenaltyPoints().equals(getPenaltyPoints())) { return getPenaltyPoints().compareTo(o.getPenaltyPoints()); } else { return getAdditionalInfoInCurrentValue().compareTo(o.getAdditionalInfoInCurrentValue()); } } } ComparisonResult();  ComparisonResult(Long penaltyPoints, Boolean additionalInfoInCurrentValue);  ComparisonResult(Long differencePenaltyPoints);  ComparisonResult(Boolean additionalInfoInCurrentValue); void addComparisonResult(ComparisonResult comparisonResult); Long getPenaltyPoints(); Boolean getAdditionalInfoInCurrentValue(); boolean isSuccessful(); int compareTo(ComparisonResult o); String toString(); static final ComparisonResult ZERO_PENALTY_POINTS; }### Answer:
@Test public void shouldCompareComparisonResultsEqually() { ComparisonResult comparisonResult = new ComparisonResult(111L); ComparisonResult anotherComparisonResult = new ComparisonResult(111L); int result = comparisonResult.compareTo(anotherComparisonResult); assertEquals(result, 0); }
@Test public void shouldCompareComparisonResultsNotEqualPenaltyPoints() { ComparisonResult comparisonResult = new ComparisonResult(110L); ComparisonResult anotherComparisonResult = new ComparisonResult(111L); int result = comparisonResult.compareTo(anotherComparisonResult); assertEquals(result, -1); }
@Test public void shouldCompareComparisonResultsWithEqualPenaltyPointsButOneWithAdditionalInfo() { ComparisonResult comparisonResult = new ComparisonResult(111L, true); ComparisonResult anotherComparisonResult = new ComparisonResult(111L); int result = comparisonResult.compareTo(anotherComparisonResult); assertEquals(result, 1); }
@Test public void shouldCompareComparisonResultsWithNull() { ComparisonResult comparisonResult = new ComparisonResult(111L); ComparisonResult anotherComparisonResult = null; int result = comparisonResult.compareTo(anotherComparisonResult); assertEquals(result, 1); }