Supplementary implements Degrees<T> { @Override public Number resolve(final InnerProduct<T> product) { return Math.PI - this.angle.resolve(product).doubleValue(); } Supplementary(final Degrees<T> angle); @Override Number resolve(final InnerProduct<T> product);  }
@Test public void resolvesSupplementaryAngle() { final Degrees<Object> first = new Degrees.Default<>(Math.random()); final Degrees<Object> second = new Degrees.Default<>(Math.random()); final Degrees<Object> third = new Degrees.Default<>(Math.random()); final InnerProduct<Object> pdt = new MkProduct<>(); final double error = 1.e-6; MatcherAssert.assertThat( new Supplementary<>(first).resolve(pdt).doubleValue() + first.resolve(pdt).doubleValue(), Matchers.closeTo(Math.PI, error) ); MatcherAssert.assertThat( new Supplementary<>(second).resolve(pdt).doubleValue() + second.resolve(pdt).doubleValue(), Matchers.closeTo(Math.PI, error) ); MatcherAssert.assertThat( new Supplementary<>(third).resolve(pdt).doubleValue() + third.resolve(pdt).doubleValue(), Matchers.closeTo(Math.PI, error) ); }