FloatCondition extends BasicCondition<Float, FloatCondition> implements FloatingPointChecks<Float, FloatCondition> { @Override public FloatCondition isNearZero() { require(this.subject).isNotNull(); if (!(Math.abs(this.subject) < DEFAULT_FLOAT_EPSILON)) { DbcAssertionError.throwNew(new IllegalArgumentException("Expected float <" + this.subject + "> to be near zero with epsilon <" + DEFAULT_FLOAT_EPSILON + ">"), this.message); } return result(); } FloatCondition(Float subject); @Override FloatCondition isGreaterThan(Float number); @Override FloatCondition isGreaterThanOrEqual(Float number); @Override FloatCondition isLessThan(Float number); @Override FloatCondition isLessThanOrEqual(Float number); @Override FloatCondition isNear(Float floatingPointNumber); @Override FloatCondition isNearWithTolerance(Float floatingPointNumber, Float tolerance); @Override FloatCondition isNearZero(); @Override FloatCondition isNearZeroWithTolerance(Float tolerance); @Deprecated @Override FloatCondition isEqualTo(Float toCompare);  }
@Test public void isNearZero() throws Exception { FloatCondition condition = new FloatCondition(0.19e-07F); condition.isNearZero(); FloatCondition badCondition = new FloatCondition(2F); assertThatThrownBy(badCondition::isNearZero) .isInstanceOf(DbcAssertionError.class) .hasCauseInstanceOf(IllegalArgumentException.class); }