IsRight implements Predicate<MetricSpaceField<T>> { @Override public boolean resolve(final MetricSpaceField<T> field) { return Double.valueOf( this.angle.resolve(field.product()).doubleValue() % Math.PI ).equals(Math.PI / 2); } IsRight(final Degrees<T> angle); @Override boolean resolve(final MetricSpaceField<T> field);  }
@Test public void resolvesTrueIfRight() { final MkField<Object> field = new MkField<>(new Object(), new Object()); MatcherAssert.assertThat( new IsRight<>(new Degrees.Default<>(Math.PI / 2)).resolve(field), Matchers.is(true) ); MatcherAssert.assertThat( new IsRight<>(new Right<>()).resolve(field), Matchers.is(true) ); }
@Test public void resolvesFalseIfNonRight() { final MkField<Object> field = new MkField<>(new Object(), new Object()); MatcherAssert.assertThat( new IsRight<>(new Degrees.Default<>(0)).resolve(field), Matchers.is(false) ); MatcherAssert.assertThat( new IsRight<>(new Flat<>()).resolve(field), Matchers.is(false) ); }