### Question:
SimpleDegree implements Degree { public int compareTo(Degree arg0) { if (arg0 == null) throw new NullPointerException("Comparing a SimpleDegree to a null Degree"); double delta = value - arg0.getValue() ; if (delta > EPSILON) return 1; else if (Math.abs(delta) < EPSILON) return 0; else return -1; } SimpleDegree();  SimpleDegree(double degree);  SimpleDegree(String degree); void setValue(double value); double getValue(); int hashCode(); boolean equals(Object obj); Degree True(); Degree False(); Degree Unknown(); Degree sum(Degree sum); Degree mul(Degree mul); Degree div(Degree div); Degree sub(Degree sub); Degree neg(); Degree max(Degree comp); Degree min(Degree comp); Degree fromConst(double number); Degree fromString(String number); Degree fromBoolean(boolean val); static Degree fromBooleanLiteral( boolean val ); boolean toBoolean(); SimpleDegree asSimpleDegree(); String toString(); double getConfidence(); int compareTo(Degree arg0); IntervalDegree asIntervalDegree(); static final Degree TRUE; static final Degree FALSE; }### Answer:
@Test public void testCompareTo() throws Exception { SimpleDegree x = new SimpleDegree(0.3); SimpleDegree y = new SimpleDegree(0.4); SimpleDegree z = new SimpleDegree(0.2); assertEquals(-1,x.compareTo(y)); assertEquals(0,x.compareTo(x)); assertEquals(1,x.compareTo(z)); }